Don't fetch profiles on conversation open if we've left group

This commit is contained in:
Scott Nonnenberg 2022-02-22 17:06:19 -08:00 committed by GitHub
parent 5453d10572
commit 4ea709f2e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,6 +39,7 @@ import { reportSpamJobQueue } from '../jobs/reportSpamJobQueue';
import type { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions'; import type { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions';
import { import {
isDirectConversation, isDirectConversation,
isGroup,
isGroupV1, isGroupV1,
} from '../util/whatTypeOfConversation'; } from '../util/whatTypeOfConversation';
import { findAndFormatContact } from '../util/findAndFormatContact'; import { findAndFormatContact } from '../util/findAndFormatContact';
@ -112,6 +113,7 @@ import { showToast } from '../util/showToast';
import { viewSyncJobQueue } from '../jobs/viewSyncJobQueue'; import { viewSyncJobQueue } from '../jobs/viewSyncJobQueue';
import { viewedReceiptsJobQueue } from '../jobs/viewedReceiptsJobQueue'; import { viewedReceiptsJobQueue } from '../jobs/viewedReceiptsJobQueue';
import { RecordingState } from '../state/ducks/audioRecorder'; import { RecordingState } from '../state/ducks/audioRecorder';
import { UUIDKind } from '../types/UUID';
type AttachmentOptions = { type AttachmentOptions = {
messageId: string; messageId: string;
@ -1253,11 +1255,17 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
); );
this.model.throttledFetchSMSOnlyUUID(); this.model.throttledFetchSMSOnlyUUID();
strictAssert( const ourUuid = window.textsecure.storage.user.getUuid(UUIDKind.ACI);
this.model.throttledGetProfiles !== undefined, if (
'Conversation model should be initialized' !isGroup(this.model.attributes) ||
); (ourUuid && this.model.hasMember(ourUuid.toString()))
await this.model.throttledGetProfiles(); ) {
strictAssert(
this.model.throttledGetProfiles !== undefined,
'Conversation model should be initialized'
);
await this.model.throttledGetProfiles();
}
this.model.updateVerified(); this.model.updateVerified();
} }