Add user badges to typing bubbles, refactor typing logic

This commit is contained in:
Evan Hahn 2021-11-15 14:01:58 -06:00 committed by GitHub
parent ede34ecee3
commit f4e336836f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 125 additions and 189 deletions

View file

@ -1400,9 +1400,6 @@ export class ConversationModel extends window.Backbone
const typingMostRecent = window._.first(
window._.sortBy(typingValues, 'timestamp')
);
const typingContact = typingMostRecent
? window.ConversationController.get(typingMostRecent.senderId)
: null;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const timestamp = this.get('timestamp')!;
@ -1440,7 +1437,7 @@ export class ConversationModel extends window.Backbone
// TODO: DESKTOP-720
/* eslint-disable @typescript-eslint/no-non-null-assertion */
const result: ConversationType = {
return {
id: this.id,
uuid: this.get('uuid'),
e164: this.get('e164'),
@ -1521,6 +1518,7 @@ export class ConversationModel extends window.Backbone
sortedGroupMembers,
timestamp,
title: this.getTitle()!,
typingContactId: typingMostRecent?.senderId,
searchableTitle: isMe(this.attributes)
? window.i18n('noteToSelf')
: this.getTitle(),
@ -1537,18 +1535,7 @@ export class ConversationModel extends window.Backbone
sharedGroupNames: [],
}),
};
if (typingContact) {
// We don't want to call .format() on our own conversation
if (typingContact.id === this.id) {
result.typingContact = result;
} else {
result.typingContact = typingContact.format();
}
}
/* eslint-enable @typescript-eslint/no-non-null-assertion */
return result;
}
updateE164(e164?: string | null): void {