Get community-id from notification data for mentions and replies (#15100)

* [Chore] Get community-id from notification data

* [Chore] Updated name for community chat
This commit is contained in:
Mohamed Javid 2023-02-16 16:10:23 +05:30 committed by GitHub
parent 5cea66647e
commit 488db615c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 17 deletions

View File

@ -36,13 +36,11 @@
parsed-text-children)))) parsed-text-children))))
(defn view (defn view
[{:keys [author chat-name chat-id message read timestamp]}] [{:keys [author chat-name community-id chat-id message read timestamp]}]
(let [chat (rf/sub [:chats/chat chat-id]) (let [community-chat? (not (string/blank? community-id))
community-id (:community-id chat) community (rf/sub [:communities/community community-id])
is-chat-from-community? (not (nil? community-id)) community-name (:name community)
community (rf/sub [:communities/community community-id]) community-image (get-in community [:images :thumbnail :uri])]
community-name (:name community)
community-image (get-in community [:images :thumbnail :uri])]
[rn/touchable-opacity [rn/touchable-opacity
{:on-press (fn [] {:on-press (fn []
(rf/dispatch [:hide-popover]) (rf/dispatch [:hide-popover])
@ -54,7 +52,7 @@
:unread? (not read) :unread? (not read)
:context [[common/user-avatar-tag author] :context [[common/user-avatar-tag author]
[quo/text {:style style/tag-text} (string/lower-case (i18n/label :t/on))] [quo/text {:style style/tag-text} (string/lower-case (i18n/label :t/on))]
(if is-chat-from-community? (if community-chat?
[quo/context-tag tag-params {:uri community-image} community-name chat-name] [quo/context-tag tag-params {:uri community-image} community-name chat-name]
[quo/group-avatar-tag chat-name tag-params])] [quo/group-avatar-tag chat-name tag-params])]
:message {:body (message-body message)}}]])) :message {:body (message-body message)}}]]))

View File

@ -1,5 +1,6 @@
(ns status-im2.contexts.activity-center.notification.reply.view (ns status-im2.contexts.activity-center.notification.reply.view
(:require [quo2.core :as quo] (:require [clojure.string :as string]
[quo2.core :as quo]
[quo2.foundations.colors :as colors] [quo2.foundations.colors :as colors]
[react-native.core :as rn] [react-native.core :as rn]
[status-im.ui2.screens.chat.messages.message :as old-message] [status-im.ui2.screens.chat.messages.message :as old-message]
@ -37,13 +38,11 @@
nil)) nil))
(defn view (defn view
[{:keys [author chat-name chat-id message read timestamp]}] [{:keys [author chat-name community-id chat-id message read timestamp]}]
(let [chat (rf/sub [:chats/chat chat-id]) (let [community-chat? (not (string/blank? community-id))
community-id (:community-id chat) community (rf/sub [:communities/community community-id])
is-chat-from-community? (not (nil? community-id)) community-name (:name community)
community (rf/sub [:communities/community community-id]) community-image (get-in community [:images :thumbnail :uri])]
community-name (:name community)
community-image (get-in community [:images :thumbnail :uri])]
[rn/touchable-opacity [rn/touchable-opacity
{:on-press (fn [] {:on-press (fn []
(rf/dispatch [:hide-popover]) (rf/dispatch [:hide-popover])
@ -55,7 +54,7 @@
:unread? (not read) :unread? (not read)
:context [[common/user-avatar-tag author] :context [[common/user-avatar-tag author]
[quo/text {:style style/lowercase-text} (i18n/label :t/on)] [quo/text {:style style/lowercase-text} (i18n/label :t/on)]
(if is-chat-from-community? (if community-chat?
[quo/context-tag tag-params {:uri community-image} community-name chat-name] [quo/context-tag tag-params {:uri community-image} community-name chat-name]
[quo/group-avatar-tag chat-name tag-params])] [quo/group-avatar-tag chat-name tag-params])]
:message {:body-number-of-lines 1 :message {:body-number-of-lines 1