Skip to content

Commit

Permalink
Fix duplicate timeline items for group call events
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn-Signal committed Dec 9, 2020
1 parent 8c771cc commit 496bdec
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ts/models/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2097,9 +2097,12 @@ export class ConversationModel extends window.Backbone.Model<
eraId: string,
creatorUuid: string
): Promise<void> {
// We want to update the cache quickly in case this function is called multiple times.
const oldCachedEraId = this.cachedLatestGroupCallEraId;
this.cachedLatestGroupCallEraId = eraId;

const alreadyHasMessage =
(this.cachedLatestGroupCallEraId &&
this.cachedLatestGroupCallEraId === eraId) ||
(oldCachedEraId && oldCachedEraId === eraId) ||
(await window.Signal.Data.hasGroupCallHistoryMessage(this.id, eraId));

if (!alreadyHasMessage) {
Expand All @@ -2110,8 +2113,6 @@ export class ConversationModel extends window.Backbone.Model<
startedTime: Date.now(),
});
}

this.cachedLatestGroupCallEraId = eraId;
}

async addProfileChange(
Expand Down

0 comments on commit 496bdec

Please sign in to comment.