|
6 | 6 | [status-im.utils.config :as config] |
7 | 7 | [status-im.utils.ethereum.core :as ethereum] |
8 | 8 | [status-im.utils.datetime :as time] |
| 9 | + [status-im.group-chats.core :as group-chats] |
9 | 10 | [status-im.chat.models :as chat-model] |
10 | 11 | [status-im.chat.models.loading :as chat-loading] |
11 | 12 | [status-im.chat.models.input :as input] |
|
124 | 125 | batch? |
125 | 126 | {:keys [from message-id chat-id content content-type clock-value js-obj] :as raw-message}] |
126 | 127 | (let [{:keys [web3 current-chat-id view-id]} db |
127 | | - current-chat? (and (or (= :chat view-id) (= :chat-modal view-id)) (= current-chat-id chat-id)) |
128 | | - {:keys [public?] :as chat} (get-in db [:chats chat-id]) |
129 | | - message (-> raw-message |
130 | | - (commands-receiving/enhance-receive-parameters cofx) |
131 | | - (ensure-clock-value chat) |
132 | | - ;; TODO (cammellos): Refactor so it's not computed twice |
133 | | - (add-outgoing-status cofx) |
134 | | - ;; TODO (janherich): Remove after couple of releases |
135 | | - update-legacy-type)] |
| 128 | + current-chat? (and (or (= :chat view-id) (= :chat-modal view-id)) (= current-chat-id chat-id)) |
| 129 | + {:keys [group-chat] :as chat} (get-in db [:chats chat-id]) |
| 130 | + message (-> raw-message |
| 131 | + (commands-receiving/enhance-receive-parameters cofx) |
| 132 | + (ensure-clock-value chat) |
| 133 | + ;; TODO (cammellos): Refactor so it's not computed twice |
| 134 | + (add-outgoing-status cofx) |
| 135 | + ;; TODO (janherich): Remove after couple of releases |
| 136 | + update-legacy-type)] |
136 | 137 | (fx/merge cofx |
137 | 138 | {:confirm-messages-processed [{:web3 web3 |
138 | 139 | :js-obj js-obj}]} |
|
145 | 146 | :else :received)) |
146 | 147 | (commands-receiving/receive message) |
147 | 148 | (display-notification chat-id) |
148 | | - (send-message-seen chat-id message-id (and (not public?) |
| 149 | + (send-message-seen chat-id message-id (and (not group-chat) |
149 | 150 | current-chat? |
150 | 151 | (not (= constants/system from)) |
151 | 152 | (not (:outgoing message))))))) |
|
208 | 209 | (if (= network-status :offline) |
209 | 210 | {:dispatch-later [{:ms 10000 |
210 | 211 | :dispatch [:update-message-status chat-id message-id current-public-key :not-sent]}]} |
211 | | - (transport/send send-record chat-id cofx))) |
| 212 | + (let [wrapped-record (if (= (:message-type send-record) :group-user-message) |
| 213 | + (group-chats/wrap-group-message cofx chat-id send-record) |
| 214 | + send-record)] |
| 215 | + |
| 216 | + (transport/send wrapped-record chat-id cofx)))) |
212 | 217 |
|
213 | 218 | (defn add-message-type [message {:keys [chat-id group-chat public?]}] |
214 | 219 | (cond-> message |
|
0 commit comments