parent
9c637fdd43
commit
75e3e10f58
|
@ -1,6 +1,7 @@
|
||||||
import NimQml, Tables, json, sequtils, chronicles
|
import NimQml, Tables, json, sequtils, chronicles
|
||||||
|
|
||||||
import ../../status/status
|
import ../../status/status
|
||||||
|
import ../../status/accounts as status_accounts
|
||||||
import ../../status/chat as status_chat
|
import ../../status/chat as status_chat
|
||||||
import ../../status/contacts as status_contacts
|
import ../../status/contacts as status_contacts
|
||||||
import ../../status/ens as status_ens
|
import ../../status/ens as status_ens
|
||||||
|
@ -238,3 +239,11 @@ QtObject:
|
||||||
|
|
||||||
proc formatENSUsername*(self: ChatsView, username: string): string {.slot.} =
|
proc formatENSUsername*(self: ChatsView, username: string): string {.slot.} =
|
||||||
result = status_ens.addDomain(username)
|
result = status_ens.addDomain(username)
|
||||||
|
|
||||||
|
proc generateIdenticon*(self: ChatsView, pk: string): string {.slot.} =
|
||||||
|
result = status_accounts.generateIdenticon(pk)
|
||||||
|
|
||||||
|
proc userNameOrAlias*(self: ChatsView, pubKey: string): string {.slot.} =
|
||||||
|
if self.status.chat.contacts.hasKey(pubKey):
|
||||||
|
return status_ens.userNameOrAlias(self.status.chat.contacts[pubKey])
|
||||||
|
generateAlias(pubKey)
|
||||||
|
|
|
@ -19,7 +19,7 @@ proc renderInline(self: ChatMessageList, elem: TextItem): string =
|
||||||
of "emph": result = fmt("<span style=\"font-style: italic;\">{elem.literal}</span> ")
|
of "emph": result = fmt("<span style=\"font-style: italic;\">{elem.literal}</span> ")
|
||||||
of "strong": result = fmt("<span style=\"font-weight: bold;\">{elem.literal}</span> ")
|
of "strong": result = fmt("<span style=\"font-weight: bold;\">{elem.literal}</span> ")
|
||||||
of "link": result = elem.destination
|
of "link": result = elem.destination
|
||||||
of "mention": result = fmt("<span style=\"color: #000000;\">{self.mention(elem.literal)}</span> ")
|
of "mention": result = fmt("<a href=\"//{elem.literal}\" style=\"font-weight: bold; color: #000000;\">@{self.mention(elem.literal)}</a> ")
|
||||||
of "status-tag": result = fmt("<a href=\"#{elem.literal}\" class=\"status-tag\">{elem.literal}</a> ")
|
of "status-tag": result = fmt("<a href=\"#{elem.literal}\" class=\"status-tag\">{elem.literal}</a> ")
|
||||||
|
|
||||||
# See render-block in status-react/src/status_im/ui/screens/chat/message/message.cljs
|
# See render-block in status-react/src/status_im/ui/screens/chat/message/message.cljs
|
||||||
|
|
|
@ -48,3 +48,6 @@ proc reset*(self: AccountModel) =
|
||||||
|
|
||||||
proc generateAlias*(publicKey: string): string =
|
proc generateAlias*(publicKey: string): string =
|
||||||
result = status_accounts.generateAlias(publicKey)
|
result = status_accounts.generateAlias(publicKey)
|
||||||
|
|
||||||
|
proc generateIdenticon*(publicKey: string): string =
|
||||||
|
result = status_accounts.generateIdenticon(publicKey)
|
||||||
|
|
|
@ -288,6 +288,12 @@ Item {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (link.startsWith('//')) {
|
||||||
|
let pk = link.replace("//", "");
|
||||||
|
profileClick(chatsModel.userNameOrAlias(pk), pk, chatsModel.generateIdenticon(pk))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Qt.openUrlExternally(link)
|
Qt.openUrlExternally(link)
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
Loading…
Reference in New Issue