Skip to content

Commit

Permalink
Fix error in getting updated with the user's profile after rejoining …
Browse files Browse the repository at this point in the history
…group (#1864)

* fix: sharing new PEKs

* chore: grunt pin:0.2.5

* chore: reverted grunt pin and removed manifest.json

---------

Co-authored-by: Greg Slepak <[email protected]>
  • Loading branch information
2 people authored and corrideat committed Mar 4, 2024
1 parent f594294 commit 84172e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions frontend/controller/actions/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,8 @@ export default (sbp('sbp/selectors/register', {
'gi.actions/identity/shareNewPEK': async (contractID: string, newKeys) => {
const rootState = sbp('state/vuex/state')
const state = rootState[contractID]
const identityContractID = state.attributes.identityContractID

// TODO: Also share PEK with DMs
await Promise.all((state.loginState?.groupIds || []).filter(groupID => !!rootState.contracts[groupID]).map(groupID => {
await Promise.all(Object.keys(state.groups || {}).filter(groupID => !!rootState.contracts[groupID]).map(groupID => {
const CEKid = findKeyIdByName(rootState[groupID], 'cek')
const CSKid = findKeyIdByName(rootState[groupID], 'csk')

Expand Down Expand Up @@ -567,7 +565,7 @@ export default (sbp('sbp/selectors/register', {
hooks: {
preSendCheck: (_, state) => {
// Don't send this message if we're no longer a group member
return state?.profiles?.[identityContractID]?.status === PROFILE_STATUS.ACTIVE
return state?.profiles?.[contractID]?.status === PROFILE_STATUS.ACTIVE
}
}
}).catch(e => {
Expand Down
5 changes: 2 additions & 3 deletions frontend/model/contracts/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -1915,9 +1915,8 @@ sbp('chelonia/defineContract', {

Promise.resolve()
.then(() => sbp('gi.contracts/group/rotateKeys', contractID))
.then(() => {
return sbp('gi.contracts/group/revokeGroupKeyAndRotateOurPEK', contractID, false)
}).catch((e) => {
.then(() => sbp('gi.contracts/group/revokeGroupKeyAndRotateOurPEK', contractID, false))
.catch((e) => {
console.error(`[gi.contracts/group/leaveGroup] for ${contractID}: Error rotating group keys or our PEK`, e)
})

Expand Down

0 comments on commit 84172e3

Please sign in to comment.