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/signals/types
import ../../../app/core/eventemitter import ../../../app/core/eventemitter
import ../../../app/global/global_singleton import ../../../app/global/global_singleton
import ../../../backend/accounts as status_accounts
import ../../../backend/messages as status_go import ../../../backend/messages as status_go
import ../contacts/service as contact_service import ../contacts/service as contact_service
import ../token/service as token_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: of PARSED_TEXT_CHILD_TYPE_STRONG_EMPH:
result = fmt(" <strong><em>{value}</em></strong> ") result = fmt(" <strong><em>{value}</em></strong> ")
of PARSED_TEXT_CHILD_TYPE_MENTION: of PARSED_TEXT_CHILD_TYPE_MENTION:
let contactDto = self.contactService.getContactById(value) var id = value
result = fmt("<a href=\"//{value}\" class=\"mention\">{contactDto.userNameOrAlias()}</a>") 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: of PARSED_TEXT_CHILD_TYPE_STATUS_TAG:
result = fmt("<a href=\"#{value}\" class=\"status-tag\">#{value}</a>") result = fmt("<a href=\"#{value}\" class=\"status-tag\">#{value}</a>")
of PARSED_TEXT_CHILD_TYPE_DEL: of PARSED_TEXT_CHILD_TYPE_DEL:

2
vendor/status-go vendored

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