mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-08-18 19:02:24 +01:00
Additional cleanup on group/distributionList deletion
This commit is contained in:
Generated
+1
@@ -20,6 +20,7 @@ overrides:
|
||||
electron@<39.8.10: ^39.8.10
|
||||
electron@<39.8.9: ^39.8.9
|
||||
ip-address@<=10.3.0: ^10.3.1
|
||||
nanoid@<3.3.17: 3.3.18
|
||||
|
||||
pnpmfileChecksum: sha256-bByyW+G0/ld7ZSgtIlcAVRHgcUTBCQ31JLSwI1rhzys=
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ overrides:
|
||||
electron@<39.8.10: ^39.8.10
|
||||
electron@<39.8.9: ^39.8.9
|
||||
ip-address@<=10.3.0: ^10.3.1
|
||||
nanoid@<3.3.17: 3.3.18
|
||||
|
||||
allowUnusedPatches: false
|
||||
ignorePatchFailures: false
|
||||
|
||||
@@ -188,6 +188,7 @@ import * as Errors from '../types/errors.std.ts';
|
||||
import { isMessageUnread } from '../util/isMessageUnread.std.ts';
|
||||
import type { SenderKeyTargetType } from '../util/sendToGroup.preload.ts';
|
||||
import {
|
||||
getOurAddress,
|
||||
resetSenderKey,
|
||||
sendContentMessageToGroup,
|
||||
} from '../util/sendToGroup.preload.ts';
|
||||
@@ -286,6 +287,7 @@ import { canConversationOnlyBeMutedAlways } from '../conversations/canConversati
|
||||
import { keyTransparency } from '../services/keyTransparency.preload.ts';
|
||||
import type { PollSource } from '../messageModifiers/Polls.preload.ts';
|
||||
import { isSignalServiceId } from '../types/SignalConversation.std.ts';
|
||||
import { QualifiedAddress } from '../types/QualifiedAddress.std.ts';
|
||||
|
||||
const { compact, isNumber, throttle, debounce } = lodash;
|
||||
|
||||
@@ -5540,6 +5542,15 @@ export class ConversationModel {
|
||||
(this.get('left') || this.get('terminated'))
|
||||
) {
|
||||
await safeCleanupAvatarFiles(this.attributes);
|
||||
const senderKeyInfo = this.get('senderKeyInfo');
|
||||
if (senderKeyInfo?.distributionId) {
|
||||
const ourAddress = getOurAddress();
|
||||
const ourAci = itemStorage.user.getCheckedAci();
|
||||
await signalProtocolStore.removeSenderKey(
|
||||
new QualifiedAddress(ourAci, ourAddress),
|
||||
senderKeyInfo.distributionId
|
||||
);
|
||||
}
|
||||
this.set(GROUP_CLEANUP_FIELDS);
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,8 @@ import { toNumber } from '../util/toNumber.std.ts';
|
||||
import { MAX_VALUE } from '../util/long.std.ts';
|
||||
import { isKnownProtoEnumMember } from '../util/isKnownProtoEnumMember.std.ts';
|
||||
import { Emoji } from '../axo/emoji.std.ts';
|
||||
import { getOurAddress } from '../util/sendToGroup.preload.ts';
|
||||
import { QualifiedAddress } from '../types/QualifiedAddress.std.ts';
|
||||
|
||||
const { isEqual } = lodash;
|
||||
|
||||
@@ -2118,6 +2120,7 @@ export async function mergeStoryDistributionListRecord(
|
||||
|
||||
const localStoryDistributionList =
|
||||
await DataReader.getStoryDistributionWithMembers(listId);
|
||||
let senderKeyInfo = localStoryDistributionList?.senderKeyInfo;
|
||||
|
||||
const details = logRecordChanges(
|
||||
localStoryDistributionList == null
|
||||
@@ -2141,14 +2144,24 @@ export async function mergeStoryDistributionListRecord(
|
||||
remoteListMembers = [];
|
||||
}
|
||||
|
||||
if (storyDistributionListRecord.$unknown) {
|
||||
details.push('adding unknown fields');
|
||||
}
|
||||
|
||||
const deletedAtTimestamp = getTimestampFromLong(
|
||||
storyDistributionListRecord.deletedAtTimestamp
|
||||
);
|
||||
|
||||
if (senderKeyInfo?.distributionId && deletedAtTimestamp) {
|
||||
const ourAddress = getOurAddress();
|
||||
const ourAci = itemStorage.user.getCheckedAci();
|
||||
await signalProtocolStore.removeSenderKey(
|
||||
new QualifiedAddress(ourAci, ourAddress),
|
||||
senderKeyInfo.distributionId
|
||||
);
|
||||
senderKeyInfo = undefined;
|
||||
}
|
||||
|
||||
if (storyDistributionListRecord.$unknown) {
|
||||
details.push('adding unknown fields');
|
||||
}
|
||||
|
||||
const storyDistribution: StoryDistributionWithMembersType = {
|
||||
id: listId,
|
||||
name: storyDistributionListRecord.name,
|
||||
@@ -2156,7 +2169,7 @@ export async function mergeStoryDistributionListRecord(
|
||||
allowsReplies: storyDistributionListRecord.allowsReplies,
|
||||
isBlockList: storyDistributionListRecord.isBlockList,
|
||||
members: remoteListMembers,
|
||||
senderKeyInfo: localStoryDistributionList?.senderKeyInfo,
|
||||
senderKeyInfo,
|
||||
|
||||
storageID,
|
||||
storageVersion,
|
||||
|
||||
@@ -20,6 +20,9 @@ import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions.s
|
||||
import { useBoundActions } from '../../hooks/useBoundActions.std.ts';
|
||||
import { itemStorage } from '../../textsecure/Storage.preload.ts';
|
||||
import { strictAssert } from '../../util/assert.std.ts';
|
||||
import { signalProtocolStore } from '../../SignalProtocolStore.preload.ts';
|
||||
import { getOurAddress } from '../../util/sendToGroup.preload.ts';
|
||||
import { QualifiedAddress } from '../../types/QualifiedAddress.std.ts';
|
||||
|
||||
const { omit } = lodash;
|
||||
|
||||
@@ -217,12 +220,15 @@ function deleteDistributionList(
|
||||
return;
|
||||
}
|
||||
|
||||
const { senderKeyInfo } = storyDistribution;
|
||||
|
||||
await DataWriter.modifyStoryDistributionWithMembers(
|
||||
{
|
||||
...storyDistribution,
|
||||
deletedAtTimestamp,
|
||||
name: '',
|
||||
storageNeedsSync: true,
|
||||
senderKeyInfo: undefined,
|
||||
},
|
||||
{
|
||||
toAdd: [],
|
||||
@@ -237,6 +243,14 @@ function deleteDistributionList(
|
||||
await Promise.all(
|
||||
storiesToDelete.map(story => deleteStoryForEveryone(stories, story))
|
||||
);
|
||||
if (senderKeyInfo?.distributionId) {
|
||||
const ourAddress = getOurAddress();
|
||||
const ourAci = itemStorage.user.getCheckedAci();
|
||||
await signalProtocolStore.removeSenderKey(
|
||||
new QualifiedAddress(ourAci, ourAddress),
|
||||
senderKeyInfo.distributionId
|
||||
);
|
||||
}
|
||||
|
||||
log.info('deleteDistributionList: list deleted', listId);
|
||||
|
||||
|
||||
@@ -1408,7 +1408,7 @@ export function _analyzeSenderKeyDevices(
|
||||
};
|
||||
}
|
||||
|
||||
function getOurAddress(): Address {
|
||||
export function getOurAddress(): Address {
|
||||
const ourAci = itemStorage.user.getCheckedAci();
|
||||
const ourDeviceId = itemStorage.user.getDeviceId();
|
||||
if (!ourDeviceId) {
|
||||
|
||||
Reference in New Issue
Block a user