Support for incoming gift badges

This commit is contained in:
Scott Nonnenberg 2022-05-11 13:59:58 -07:00 committed by GitHub
parent 6b4bea6330
commit 0ba6a0926e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 1476 additions and 164 deletions

View file

@ -11,6 +11,7 @@ import { markViewed } from '../services/MessageUpdater';
import { isIncoming, isStory } from '../state/selectors/message';
import { notificationService } from '../services/notifications';
import * as log from '../logging/log';
import { GiftBadgeStates } from '../components/conversation/Message';
export type ViewSyncAttributesType = {
senderId: string;
@ -92,6 +93,16 @@ export class ViewSyncs extends Collection {
message.set(markViewed(message.attributes, sync.get('viewedAt')));
}
const giftBadge = message.get('giftBadge');
if (giftBadge) {
message.set({
giftBadge: {
...giftBadge,
state: GiftBadgeStates.Redeemed,
},
});
}
this.remove(sync);
} catch (error) {
log.error(