Skip to content

Commit

Permalink
feat: set lastLoggedIn as soon as join the group (#2086)
Browse files Browse the repository at this point in the history
  • Loading branch information
Silver-IT authored Jun 19, 2024
1 parent 8e35f72 commit 1008f03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions frontend/controller/actions/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ export default (sbp('sbp/selectors/register', {
postpublish: null
}
})

await sbp('gi.actions/group/updateLastLoggedIn', {
contractID: params.contractID
}).catch((e) => console.error('[gi.actions/group/join] Error sending updateLastLoggedIn', e))
} catch (e) {
console.error(`[gi.actions/group/join] Error while sending key request for ${params.contractID}:`, e)
throw e
Expand Down
12 changes: 6 additions & 6 deletions frontend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ async function startApp () {
}
}
},
[NOTIFICATION_TYPE.KV] ([key, data]) {
[NOTIFICATION_TYPE.KV] ([key, value]) {
const rootState = sbp('state/vuex/state')
const { contractID, data: value } = data
const { contractID, data } = value

if (key === KV_KEYS.LAST_LOGGED_IN && value) {
Vue.set(rootState.lastLoggedIn, contractID, value)
} else if (key === KV_KEYS.UNREAD_MESSAGES && value) {
sbp('state/vuex/commit', 'setUnreadMessages', value)
if (key === KV_KEYS.LAST_LOGGED_IN && data) {
Vue.set(rootState.lastLoggedIn, contractID, data)
} else if (key === KV_KEYS.UNREAD_MESSAGES && data) {
sbp('state/vuex/commit', 'setUnreadMessages', data)
}
}
}
Expand Down

0 comments on commit 1008f03

Please sign in to comment.