From 29a7e4dc1caea8ac65eb04477202a184d8dec3b0 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Fri, 24 Dec 2021 13:39:51 +0200 Subject: [PATCH] [#12918] Show history gaps only in public chats and communities --- .../ui/screens/chat/message/gap.cljs | 41 ++++++++++--------- src/status_im/ui/screens/chat/views.cljs | 5 ++- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/status_im/ui/screens/chat/message/gap.cljs b/src/status_im/ui/screens/chat/message/gap.cljs index f0460dd0a0..d67828185d 100644 --- a/src/status_im/ui/screens/chat/message/gap.cljs +++ b/src/status_im/ui/screens/chat/message/gap.cljs @@ -12,28 +12,29 @@ (re-frame/dispatch [:chat.ui/fill-gaps chat-id gap-ids]))) (views/defview gap - [{:keys [gap-ids chat-id gap-parameters]}] + [{:keys [gap-ids chat-id gap-parameters public? community?]}] (views/letsubs [in-progress? [:chats/fetching-gap-in-progress? gap-ids chat-id] connected? [:mailserver/connected?] first-gap? (= gap-ids #{:first-gap})] - [react/view {:style (style/gap-container)} - [react/touchable-highlight - {:on-press (when (and connected? (not in-progress?)) - (on-press chat-id gap-ids)) - :style style/touchable} - [react/view {:style style/label-container} - (if in-progress? - [react/activity-indicator] - [react/nested-text - {:style (style/gap-text connected?)} - (i18n/label (if first-gap? :t/load-more-messages :t/fetch-messages)) - (when first-gap? - [{:style style/date} - (let [date (datetime/timestamp->long-date - (* 1000 (:from gap-parameters)))] - (str - "\n" - (i18n/label :t/load-messages-before - {:date date})))])])]]])) + (when (or (not first-gap?) public? community?) + [react/view {:style (style/gap-container)} + [react/touchable-highlight + {:on-press (when (and connected? (not in-progress?)) + (on-press chat-id gap-ids)) + :style style/touchable} + [react/view {:style style/label-container} + (if in-progress? + [react/activity-indicator] + [react/nested-text + {:style (style/gap-text connected?)} + (i18n/label (if first-gap? :t/load-more-messages :t/fetch-messages)) + (when first-gap? + [{:style style/date} + (let [date (datetime/timestamp->long-date + (* 1000 (:from gap-parameters)))] + (str + "\n" + (i18n/label :t/load-messages-before + {:date date})))])])]]]))) diff --git a/src/status_im/ui/screens/chat/views.cljs b/src/status_im/ui/screens/chat/views.cljs index f247a48f3b..ce09afda53 100644 --- a/src/status_im/ui/screens/chat/views.cljs +++ b/src/status_im/ui/screens/chat/views.cljs @@ -243,7 +243,8 @@ (defn render-fn [{:keys [outgoing type] :as message} idx _ - {:keys [group-chat public? current-public-key space-keeper chat-id show-input? message-pin-enabled edit-enabled in-pinned-view?]}] + {:keys [group-chat public? community? current-public-key space-keeper + chat-id show-input? message-pin-enabled edit-enabled in-pinned-view?]}] [react/view {:style (when (and platform/android? (not in-pinned-view?)) {:scaleY -1})} (if (= type :datemark) [message-datemark/chat-datemark (:value message)] @@ -255,6 +256,7 @@ :incoming-group (and group-chat (not outgoing)) :group-chat group-chat :public? public? + :community? community? :current-public-key current-public-key :show-input? show-input? :message-pin-enabled message-pin-enabled @@ -285,6 +287,7 @@ community-admin?))))] {:group-chat group-chat :public? public? + :community? (not (nil? community-id)) :current-public-key current-public-key :space-keeper space-keeper :chat-id chat-id