Update Backbone types: attributes is T - and fix failing type checks

This commit is contained in:
Scott Nonnenberg 2023-01-05 13:58:13 -08:00 committed by GitHub
parent c65a7d0a14
commit b8234765bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 57 additions and 24 deletions

View file

@ -2558,7 +2558,9 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
storyId: storyQuote?.id,
};
const dataMessage = await upgradeMessageSchema(withQuoteReference);
// There are type conflicts between ModelAttributesType and protos passed in here
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const dataMessage = await upgradeMessageSchema(withQuoteReference as any);
const isGroupStoryReply =
isGroup(conversation.attributes) && dataMessage.storyId;
@ -2712,7 +2714,18 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
};
}
attributes.avatar = avatar;
if (!avatar) {
attributes.avatar = avatar;
} else {
const { url, path } = avatar;
strictAssert(url, 'Avatar needs url');
strictAssert(path, 'Avatar needs path');
attributes.avatar = {
url,
path,
...avatar,
};
}
pendingGroupUpdate.avatarUpdated = true;
} else {