[Fixes: #15093] Add support for mention @everyone

This commit adds support for displaying @everyone mention.
This commit is contained in:
Andrea Maria Piana 2023-02-15 17:22:21 +00:00
parent 46896ff7f4
commit c4aef97a6d
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
11 changed files with 22 additions and 8 deletions

View File

@ -42,7 +42,7 @@
(get-quoted-text-with-mentions children)
(= type "mention")
@(re-frame/subscribe [:contacts/contact-name-by-identity literal])
@(re-frame/subscribe [:messages/resolve-mention literal])
(seq children)
(get-quoted-text-with-mentions children)

View File

@ -43,7 +43,7 @@
(get-quoted-text-with-mentions children)
(= type "mention")
@(re-frame/subscribe [:contacts/contact-name-by-identity literal])
@(re-frame/subscribe [:messages/resolve-mention literal])
(seq children)
(get-quoted-text-with-mentions children)

View File

@ -49,7 +49,7 @@
"mention"
{:components [react/text-class
@(re-frame/subscribe [:contacts/contact-name-by-identity literal])]
@(re-frame/subscribe [:messages/resolve-mention literal])]
:length 4} ;; we can't predict name length so take the smallest possible
"status-tag"

View File

@ -22,7 +22,7 @@
(get-quoted-text-with-mentions children)
(= type "mention")
(rf/sub [:contacts/contact-name-by-identity literal])
(rf/sub [:messages/resolve-mention literal])
(seq children)
(get-quoted-text-with-mentions children)

View File

@ -35,7 +35,7 @@
(defn mention-element
[from]
(rf/sub [:contacts/contact-name-by-identity from]))
(rf/sub [:messages/resolve-mention from]))
(defn render-inline
[_message-text content-type acc {:keys [type literal destination]}]

View File

@ -281,3 +281,5 @@
(def ^:const local-pair-action-connect 1)
(def ^:const local-pair-action-pairing-account 2)
(def ^:const local-pair-action-sync-device 3)
(def ^:const everyone-mention-id "0x00001")

View File

@ -31,7 +31,7 @@
"mention" [quo/text
{:style style/mention-text
:size :paragraph-1}
(str "@" (rf/sub [:contacts/contact-name-by-identity literal]))]
(str "@" (rf/sub [:messages/resolve-mention literal]))]
literal))
parsed-text-children))))

View File

@ -38,7 +38,7 @@
children)
"mention"
{:components [quo/text (rf/sub [:contacts/contact-name-by-identity literal])]
{:components [quo/text (rf/sub [:messages/resolve-mention literal])]
:length 4} ;; we can't predict name length so take the
;; smallest possible

View File

@ -46,7 +46,7 @@
[quo/text
{:weight :medium
:style {:color (colors/theme-colors colors/primary-50 colors/primary-60)}}
(rf/sub [:contacts/contact-name-by-identity literal])]])
(rf/sub [:messages/resolve-mention literal])]])
(conj units literal)))

View File

@ -3,6 +3,7 @@
[status-im.chat.models.reactions :as models.reactions]
[status-im2.constants :as constants]
[status-im2.contexts.chat.messages.list.events :as models.message-list]
[utils.i18n :as i18n]
[utils.datetime :as datetime]))
(defn intersperse-datemark
@ -271,3 +272,13 @@
joined
loading-messages?)
(albumize-messages))))))
(re-frame/reg-sub
:messages/resolve-mention
(fn [[_ mention] _]
[(re-frame/subscribe [:contacts/contact-name-by-identity mention])])
(fn [[contact-name] [_ mention]]
(if (= mention constants/everyone-mention-id)
(i18n/label :t/everyone-mention)
contact-name)))

View File

@ -1629,6 +1629,7 @@
"transfer-ma-unknown-error-desc-1": "It looks like your multiaccount was not deleted. Database may have been reset",
"transfer-ma-unknown-error-desc-2": "Please check your account list and try again. If the account is not listed go to Access existing keys to recover with seed phrase",
"everyone": "Everyone",
"everyone-mention": "everyone",
"show-profile-pictures": "See profile pictures from",
"show-profile-pictures-to": "Show your profile picture to",
"non-archival-node": "RPC endpoint doesn't support archival requests. Your local transfers history might be incomplete.",