Merge pull request #42 from Bilb/groups-fixes

feat: add correct url for group v1 banner + more group fixes
pull/3281/head
Audric Ackermann 3 months ago committed by GitHub
commit 431af493ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -667,7 +667,7 @@ function OutdatedLegacyGroupBanner(props: {
<NoticeBanner
text={window.i18n('groupLegacyBanner', { date: '[Date]' })} // Remove after QA
onBannerClick={() => {
showLinkVisitWarningDialog('https://getsession.org/blog/session-groups-v2', dispatch);
showLinkVisitWarningDialog('https://getsession.org/groups', dispatch);
}}
icon="externalLink"
dataTestId="legacy-group-banner"

@ -54,7 +54,7 @@ export class GroupUpdateDeleteMemberContentMessage extends GroupUpdateMessage {
public dataProto(): SignalService.DataMessage {
// If we have the secretKey, we can delete it for anyone `"DELETE_CONTENT" || timestamp || sessionId[0] || ... || messageHashes[0] || ...`
let adminSignature = new Uint8Array();
let adminSignature: Uint8Array | undefined;
if (this.secretKey && !_.isEmpty(this.secretKey) && this.sodium) {
adminSignature = this.sodium.crypto_sign_detached(
stringToUint8Array(

@ -79,9 +79,19 @@ async function confirmPushedAndDump(
assertUnreachable(namespace, 'buildAndSaveDumpsToDB assertUnreachable');
}
}
try {
await MetaGroupWrapperActions.metaConfirmPushed(...toConfirm);
return LibSessionUtil.saveDumpsToDb(groupPk);
await LibSessionUtil.saveDumpsToDb(groupPk);
} catch (e) {
// The reason we catch exception here is because sometimes we can have a race condition where
// - we push a change to the group (req1 takes 10s)
// - while req1 is running, a poll merge results with the group marked as destroyed
// - this means we have free the wrapper
// - then, req finishes, and tries to metaConfirmPushed/saveDumpsToDb which fails as the wrapper was freed.
window.log.warn(
`metaConfirmPushed/saveDumpsToDb for group ${ed25519Str(groupPk)} failed with ${e.message}. This can safely be ignored` // I hope
);
}
}
async function pushChangesToGroupSwarmIfNeeded({

@ -345,6 +345,7 @@ function batchResultsToUserSuccessfulChange(
async function saveDumpsToDb(pubkey: PubkeyType | GroupPubkeyType) {
// first check if this is relating a group
if (PubKey.is03Pubkey(pubkey)) {
try {
const metaNeedsDump = await MetaGroupWrapperActions.needsDump(pubkey);
// save the concatenated dumps as a single entry in the DB if any of the dumps had a need for dump
if (metaNeedsDump) {
@ -361,6 +362,16 @@ async function saveDumpsToDb(pubkey: PubkeyType | GroupPubkeyType) {
} else {
window.log.debug(`No need to update local dumps for metagroup ${ed25519Str(pubkey)}`);
}
} catch (e) {
// The reason we catch exception here is because sometimes we can have a race condition where
// - we push a change to the group (req1 takes 10s)
// - while req1 is running, a poll merge results with the group marked as destroyed
// - this means we have to free the wrapper
// - then, req finishes, and tries to saveDumpsToDb which fails as the wrapper was freed.
window.log.warn(
`saveDumpsToDb for group ${ed25519Str(pubkey)} failed with ${e.message}. This can safely be ignored` // I hope
);
}
return;
}
// here, we can only be called with our current user pubkey

Loading…
Cancel
Save