From 488db615c083ea4967f885346a369320f4942620 Mon Sep 17 00:00:00 2001 From: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com> Date: Thu, 16 Feb 2023 16:10:23 +0530 Subject: [PATCH] Get community-id from notification data for mentions and replies (#15100) * [Chore] Get community-id from notification data * [Chore] Updated name for community chat --- .../notification/mentions/view.cljs | 14 ++++++-------- .../notification/reply/view.cljs | 17 ++++++++--------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/status_im2/contexts/activity_center/notification/mentions/view.cljs b/src/status_im2/contexts/activity_center/notification/mentions/view.cljs index 1c5e1e3b21..bf94360ed1 100644 --- a/src/status_im2/contexts/activity_center/notification/mentions/view.cljs +++ b/src/status_im2/contexts/activity_center/notification/mentions/view.cljs @@ -36,13 +36,11 @@ parsed-text-children)))) (defn view - [{:keys [author chat-name chat-id message read timestamp]}] - (let [chat (rf/sub [:chats/chat chat-id]) - community-id (:community-id chat) - is-chat-from-community? (not (nil? community-id)) - community (rf/sub [:communities/community community-id]) - community-name (:name community) - community-image (get-in community [:images :thumbnail :uri])] + [{:keys [author chat-name community-id chat-id message read timestamp]}] + (let [community-chat? (not (string/blank? community-id)) + community (rf/sub [:communities/community community-id]) + community-name (:name community) + community-image (get-in community [:images :thumbnail :uri])] [rn/touchable-opacity {:on-press (fn [] (rf/dispatch [:hide-popover]) @@ -54,7 +52,7 @@ :unread? (not read) :context [[common/user-avatar-tag author] [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/group-avatar-tag chat-name tag-params])] :message {:body (message-body message)}}]])) diff --git a/src/status_im2/contexts/activity_center/notification/reply/view.cljs b/src/status_im2/contexts/activity_center/notification/reply/view.cljs index 0303c335dd..378668892e 100644 --- a/src/status_im2/contexts/activity_center/notification/reply/view.cljs +++ b/src/status_im2/contexts/activity_center/notification/reply/view.cljs @@ -1,5 +1,6 @@ (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] [react-native.core :as rn] [status-im.ui2.screens.chat.messages.message :as old-message] @@ -37,13 +38,11 @@ nil)) (defn view - [{:keys [author chat-name chat-id message read timestamp]}] - (let [chat (rf/sub [:chats/chat chat-id]) - community-id (:community-id chat) - is-chat-from-community? (not (nil? community-id)) - community (rf/sub [:communities/community community-id]) - community-name (:name community) - community-image (get-in community [:images :thumbnail :uri])] + [{:keys [author chat-name community-id chat-id message read timestamp]}] + (let [community-chat? (not (string/blank? community-id)) + community (rf/sub [:communities/community community-id]) + community-name (:name community) + community-image (get-in community [:images :thumbnail :uri])] [rn/touchable-opacity {:on-press (fn [] (rf/dispatch [:hide-popover]) @@ -55,7 +54,7 @@ :unread? (not read) :context [[common/user-avatar-tag author] [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/group-avatar-tag chat-name tag-params])] :message {:body-number-of-lines 1