From 302020653b5db33a9335bf50cb5359a9fd8cd1be Mon Sep 17 00:00:00 2001 From: Ibrahem Khalil Date: Sun, 28 Jan 2024 14:59:10 +0200 Subject: [PATCH] Add lastOpenedAt and JoinedAt for communities (#18439) --- .../status_im/data_store/communities.cljs | 4 +++- .../contexts/communities/events.cljs | 19 +++++++++++++++++-- status-go-version.json | 6 +++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/legacy/status_im/data_store/communities.cljs b/src/legacy/status_im/data_store/communities.cljs index 3553b4989a..80ca8268c7 100644 --- a/src/legacy/status_im/data_store/communities.cljs +++ b/src/legacy/status_im/data_store/communities.cljs @@ -57,7 +57,9 @@ :tokenPermissions :token-permissions :communityTokensMetadata :tokens-metadata :introMessage :intro-message - :muteTill :muted-till}) + :muteTill :muted-till + :lastOpenedAt :last-opened-at + :joinedAt :joined-at}) (update :admin-settings set/rename-keys {:pinMessageAllMembersEnabled :pin-message-all-members-enabled?}) diff --git a/src/status_im/contexts/communities/events.cljs b/src/status_im/contexts/communities/events.cljs index f1f90ef266..bd6632e392 100644 --- a/src/status_im/contexts/communities/events.cljs +++ b/src/status_im/contexts/communities/events.cljs @@ -362,14 +362,16 @@ (rf/merge cofx {:fx [[:dispatch [:communities/fetch-community deserialized-key]] - [:dispatch [:navigate-to :community-overview deserialized-key]]]} + [:dispatch [:navigate-to :community-overview deserialized-key]] + [:dispatch [:communities/update-last-opened-at deserialized-key]]]} (navigation/pop-to-root :shell-stack))))) (rf/reg-event-fx :communities/navigate-to-community-chat (fn [{:keys [db]} [chat-id pop-to-root?]] (let [{:keys [community-id]} (get-in db [:chats chat-id])] {:fx [(when community-id - [:dispatch [:communities/fetch-community community-id]]) + [:dispatch [:communities/fetch-community community-id]] + [:dispatch [:communities/update-last-opened-at community-id]]) (if pop-to-root? [:dispatch [:chat/pop-to-root-and-navigate-to-chat chat-id]] [:dispatch [:chat/navigate-to-chat chat-id]])]}))) @@ -424,3 +426,16 @@ (fn [{:keys [db]} [community-id]] (when (get-in db [:communities community-id]) {:db (update-in db [:communities community-id] dissoc :fetching-revealed-accounts)}))) + +(rf/reg-event-fx :communities/update-last-opened-at + (fn [_ [community-id]] + {:json-rpc/call [{:method "wakuext_communityUpdateLastOpenedAt" + :params [community-id] + :on-success #(rf/dispatch [:communities/update-last-opened-at-success community-id + %]) + :on-error #(log/error (str "failed to update last opened at for community " + %))}]})) + +(rf/reg-event-fx :communities/update-last-opened-at-success + (fn [{:keys [db]} [community-id last-opened-at]] + {:db (assoc-in db [:communities community-id :last-opened-at] last-opened-at)})) diff --git a/status-go-version.json b/status-go-version.json index 794f1d642a..3a73ff331f 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,7 +3,7 @@ "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v0.172.6", - "commit-sha1": "6e30fbb211b0e0bb1e7966cce4e215c4080aac5c", - "src-sha256": "1k3hg2m25qvgvqxmy8im3xhjwvdyvaq49yks92642h9rw494nb94" + "version": "v0.172.8", + "commit-sha1": "436d22985661322ffda4eb44c1a160e6804f3823", + "src-sha256": "1y3l469k2085qaml7dmaky1rlanl4phq2p6yyk97074yw839jzj1" }