Skip to content

Commit 50dffd4

Browse files
committed
fix public chat deletion and name display issues post-migration
1 parent 711fd19 commit 50dffd4

File tree

6 files changed

+37
-13
lines changed

6 files changed

+37
-13
lines changed

Diff for: src/status_im/common/confirmation_drawer/view.cljs

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[react-native.core :as rn]
66
[reagent.core :as reagent]
77
[status-im.common.confirmation-drawer.style :as style]
8+
[status-im.constants :as constants]
89
[utils.i18n :as i18n]
910
[utils.re-frame :as rf]))
1011

@@ -35,11 +36,12 @@
3536
close-button-text]}]
3637
(let [extra-action-selected? (reagent/atom false)]
3738
(fn []
38-
(let [{:keys [group-chat chat-id public-key color
39+
(let [{:keys [group-chat chat-id public-key color chat-type
3940
profile-picture name]} context
4041
id (or chat-id public-key)
4142
theme (quo.theme/use-theme)
42-
[primary-name _] (when-not group-chat
43+
[primary-name _] (when-not (or group-chat
44+
(= chat-type constants/public-chat-type))
4345
(rf/sub [:contacts/contact-two-names-by-identity id]))
4446
display-name (cond
4547
(= primary-name "Unknown")

Diff for: src/status_im/common/home/actions/view.cljs

+11-3
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,11 @@
398398
:chevron? false}))
399399

400400
(defn destructive-actions
401-
[{:keys [group-chat] :as item} inside-chat?]
401+
[{:keys [group-chat chat-type] :as item} inside-chat?]
402402
[(when (not group-chat)
403-
(close-chat-entry item inside-chat? (not group-chat)))
404-
(clear-history-entry item group-chat)
403+
(close-chat-entry item inside-chat? (not= chat-type constants/public-chat-type)))
404+
(when-not (= chat-type constants/public-chat-type)
405+
(clear-history-entry item group-chat))
405406
(when group-chat
406407
(leave-group-entry item nil))])
407408

@@ -438,6 +439,11 @@
438439
(notification-actions item inside-chat? true)
439440
(destructive-actions item inside-chat?)]])
440441

442+
(defn public-chat-actions
443+
[item inside-chat?]
444+
[quo/action-drawer
445+
[(destructive-actions item inside-chat?)]])
446+
441447
(defn private-group-chat-actions
442448
[item inside-chat?]
443449
[quo/action-drawer
@@ -473,6 +479,8 @@
473479
[one-to-one-actions chat inside-chat?]
474480
constants/private-group-chat-type
475481
[private-group-chat-actions chat inside-chat?]
482+
constants/public-chat-type
483+
[public-chat-actions chat inside-chat?]
476484
constants/community-chat-type
477485
[communities-chat-actions/actions chat inside-chat? hide-show-members?]
478486
nil))

Diff for: src/status_im/contexts/chat/events.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
(multi-user-chat? (get-chat cofx chat-id))))
3434

3535
(defn public-chat?
36-
([chat]
37-
(:public? chat))
36+
([{:keys [chat-type]}]
37+
(= chat-type constants/public-chat-type))
3838
([cofx chat-id]
3939
(public-chat? (get-chat cofx chat-id))))
4040

@@ -52,7 +52,7 @@
5252
(defn group-chat?
5353
([chat]
5454
(and (multi-user-chat? chat)
55-
(not (public-chat? chat))))
55+
(not (:public? chat))))
5656
([cofx chat-id]
5757
(group-chat? (get-chat cofx chat-id))))
5858

Diff for: src/status_im/contexts/chat/home/chat_list_item/view.cljs

+8-2
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,17 @@
237237

238238
(defn chat-item
239239
[{:keys [chat-id group-chat color name last-message timestamp muted image
240-
unviewed-messages-count]
240+
chat-type unviewed-messages-count]
241241
:as item}]
242242
(let [[primary-name secondary-name]
243-
(if group-chat
243+
(cond
244+
group-chat
244245
[name ""]
246+
247+
(= chat-type constants/public-chat-type)
248+
[(str "#" name) ""]
249+
250+
:else
245251
(rf/sub [:contacts/contact-two-names-by-identity chat-id]))
246252
{:keys [ens-verified added?] :as contact} (when-not group-chat
247253
(rf/sub [:contacts/contact-by-address chat-id]))

Diff for: src/status_im/contexts/chat/messenger/messages/contact_requests/bottom_drawer/view.cljs

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
(defn view
1313
[{:keys [contact-id]}]
1414
(let [customization-color (rf/sub [:profile/customization-color])
15-
[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity contact-id])
1615
{:keys [contact-request-state
17-
community-id]} (rf/sub [:chats/current-chat-chat-view])
16+
community-id
17+
chat-name]} (rf/sub [:chats/current-chat-chat-view])
1818
chat-type (rf/sub [:chats/chat-type])
19+
[primary-name _] (if (= chat-type :public-chat)
20+
[(str "#" chat-name) ""]
21+
(rf/sub [:contacts/contact-two-names-by-identity contact-id]))
1922
community-chat? (= chat-type :community-chat)
2023
joined (when community-chat?
2124
(rf/sub [:communities/community-joined community-id]))

Diff for: src/status_im/subs/chats.cljs

+6-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@
125125
:<- [:contacts/blocked-set]
126126
:<- [:contacts/contacts-raw]
127127
:<- [:chat/inputs]
128-
(fn [[{:keys [group-chat chat-id] :as current-chat} my-public-key community blocked-users-set contacts
128+
(fn [[{:keys [group-chat chat-id chat-name name] :as current-chat} my-public-key community
129+
blocked-users-set contacts
129130
inputs]]
130131
(when current-chat
131132
(cond-> current-chat
@@ -140,6 +141,9 @@
140141
(assoc :able-to-send-message? true
141142
:member? true)
142143

144+
(not chat-name)
145+
(assoc :chat-name name)
146+
143147
(not group-chat)
144148
(assoc
145149
:contact-request-state (get-in contacts [chat-id :contact-request-state])
@@ -164,6 +168,7 @@
164168
(condp apply [current-chat]
165169
chat.events/community-chat? :community-chat
166170
chat.events/group-chat? :group-chat
171+
chat.events/public-chat? :public-chat
167172
:chat)))
168173

169174
(re-frame/reg-sub

0 commit comments

Comments
 (0)