Sync MyStories using the ID not the name

This commit is contained in:
Josh Perez 2022-08-03 20:10:05 -04:00 committed by GitHub
parent 6d1a27be5a
commit 782838c591
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 18 deletions

View file

@ -2715,7 +2715,7 @@ export async function startApp(): Promise<void> {
const partialConversation: ValidateConversationType = {
e164: details.number,
uuid: UUID.fromString(details.uuid),
uuid: UUID.cast(details.uuid),
type: 'private',
};
@ -3454,9 +3454,7 @@ export async function startApp(): Promise<void> {
serverTimestamp: data.serverTimestamp,
source: data.source,
sourceDevice: data.sourceDevice,
sourceUuid: data.sourceUuid
? UUID.fromString(data.sourceUuid)
: undefined,
sourceUuid: data.sourceUuid ? UUID.cast(data.sourceUuid) : undefined,
timestamp: data.timestamp,
type: data.message.isStory ? 'story' : 'incoming',
unidentifiedDeliveryReceived: data.unidentifiedDeliveryReceived,

View file

@ -239,9 +239,7 @@ export const StoriesSettingsModal = ({
return undefined;
}
const isSelected = selectedConversationUuids.has(
UUID.fromString(contact.uuid)
);
const isSelected = selectedConversationUuids.has(UUID.cast(contact.uuid));
return {
type: RowType.ContactCheckbox,

View file

@ -44,13 +44,15 @@ import * as preferredReactionEmoji from '../reactions/preferredReactionEmoji';
import { SignalService as Proto } from '../protobuf';
import * as log from '../logging/log';
import type { UUIDStringType } from '../types/UUID';
import { MY_STORIES_ID } from '../types/Stories';
import * as Stickers from '../types/Stickers';
import type {
StoryDistributionWithMembersType,
StickerPackInfoType,
} from '../sql/Interface';
import dataInterface from '../sql/Client';
import { MY_STORIES_ID } from '../types/Stories';
const MY_STORIES_BYTES = uuidToBytes(MY_STORIES_ID);
type RecordClass =
| Proto.IAccountRecord
@ -1265,10 +1267,12 @@ export async function mergeStoryDistributionListRecord(
const details: Array<string> = [];
const listId =
storyDistributionListRecord.name === MY_STORIES_ID
? MY_STORIES_ID
: bytesToUuid(storyDistributionListRecord.identifier);
const listId = Bytes.areEqual(
MY_STORIES_BYTES,
storyDistributionListRecord.identifier
)
? MY_STORIES_ID
: bytesToUuid(storyDistributionListRecord.identifier);
if (!listId) {
throw new Error('Could not parse distribution list id');
@ -1279,7 +1283,7 @@ export async function mergeStoryDistributionListRecord(
const remoteListMembers: Array<UUIDStringType> = (
storyDistributionListRecord.recipientUuids || []
).map(UUID.fromString);
).map(UUID.cast);
if (storyDistributionListRecord.__unknownFields) {
details.push('adding unknown fields');

View file

@ -77,8 +77,4 @@ export class UUID {
}
return new UUID(`${padded}-0000-4000-8000-${'0'.repeat(12)}`);
}
public static fromString(value: string): UUIDStringType {
return new UUID(value).toString();
}
}

View file

@ -84,7 +84,7 @@ export async function sendStoryMessage(
return acc;
}
const uuid = UUID.fromString(id);
const uuid = UUID.cast(id);
if (inBlockList.has(uuid)) {
return acc;
}