Add lastOpenedAt and JoinedAt for communities (#18439)

This commit is contained in:
Ibrahem Khalil 2024-01-28 14:59:10 +02:00 committed by GitHub
parent 205b74cd34
commit 302020653b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 6 deletions

View File

@ -57,7 +57,9 @@
:tokenPermissions :token-permissions :tokenPermissions :token-permissions
:communityTokensMetadata :tokens-metadata :communityTokensMetadata :tokens-metadata
:introMessage :intro-message :introMessage :intro-message
:muteTill :muted-till}) :muteTill :muted-till
:lastOpenedAt :last-opened-at
:joinedAt :joined-at})
(update :admin-settings (update :admin-settings
set/rename-keys set/rename-keys
{:pinMessageAllMembersEnabled :pin-message-all-members-enabled?}) {:pinMessageAllMembersEnabled :pin-message-all-members-enabled?})

View File

@ -362,14 +362,16 @@
(rf/merge (rf/merge
cofx cofx
{:fx [[:dispatch [:communities/fetch-community deserialized-key]] {: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))))) (navigation/pop-to-root :shell-stack)))))
(rf/reg-event-fx :communities/navigate-to-community-chat (rf/reg-event-fx :communities/navigate-to-community-chat
(fn [{:keys [db]} [chat-id pop-to-root?]] (fn [{:keys [db]} [chat-id pop-to-root?]]
(let [{:keys [community-id]} (get-in db [:chats chat-id])] (let [{:keys [community-id]} (get-in db [:chats chat-id])]
{:fx [(when community-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? (if pop-to-root?
[:dispatch [:chat/pop-to-root-and-navigate-to-chat chat-id]] [:dispatch [:chat/pop-to-root-and-navigate-to-chat chat-id]]
[:dispatch [:chat/navigate-to-chat chat-id]])]}))) [:dispatch [:chat/navigate-to-chat chat-id]])]})))
@ -424,3 +426,16 @@
(fn [{:keys [db]} [community-id]] (fn [{:keys [db]} [community-id]]
(when (get-in db [:communities community-id]) (when (get-in db [:communities community-id])
{:db (update-in db [:communities community-id] dissoc :fetching-revealed-accounts)}))) {: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)}))

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>", "_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.172.6", "version": "v0.172.8",
"commit-sha1": "6e30fbb211b0e0bb1e7966cce4e215c4080aac5c", "commit-sha1": "436d22985661322ffda4eb44c1a160e6804f3823",
"src-sha256": "1k3hg2m25qvgvqxmy8im3xhjwvdyvaq49yks92642h9rw494nb94" "src-sha256": "1y3l469k2085qaml7dmaky1rlanl4phq2p6yyk97074yw839jzj1"
} }