feat: support compressed pubkey mentions

This commit is contained in:
Richard Ramos 2022-06-27 10:06:28 -04:00
parent 8685ad92c9
commit 813cddfb1f
2 changed files with 7 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import ../../../app/core/tasks/[qt, threadpool]
import ../../../app/core/signals/types
import ../../../app/core/eventemitter
import ../../../app/global/global_singleton
import ../../../backend/accounts as status_accounts
import ../../../backend/messages as status_go
import ../contacts/service as contact_service
import ../token/service as token_service
@ -665,8 +666,11 @@ proc renderInline(self: Service, parsedText: ParsedText): string =
of PARSED_TEXT_CHILD_TYPE_STRONG_EMPH:
result = fmt(" <strong><em>{value}</em></strong> ")
of PARSED_TEXT_CHILD_TYPE_MENTION:
let contactDto = self.contactService.getContactById(value)
result = fmt("<a href=\"//{value}\" class=\"mention\">{contactDto.userNameOrAlias()}</a>")
var id = value
if isCompressedPubKey(id):
id = status_accounts.decompressPk(id).result
let contactDto = self.contactService.getContactById(id)
result = fmt("<a href=\"//{id}\" class=\"mention\">{contactDto.userNameOrAlias()}</a>")
of PARSED_TEXT_CHILD_TYPE_STATUS_TAG:
result = fmt("<a href=\"#{value}\" class=\"status-tag\">#{value}</a>")
of PARSED_TEXT_CHILD_TYPE_DEL:

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 2873e65a611ed00782d3b833f5a6c2340f98939d
Subproject commit 05073a96407ca40313663f7423195ce767c6d9c5