Migration: Use pendingMember roles, better 'you were invited'

This commit is contained in:
Scott Nonnenberg 2020-12-01 15:45:39 -08:00 committed by GitHub
parent bb5036364e
commit b3c161f484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 166 additions and 78 deletions

View file

@ -515,17 +515,40 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
}
getPropsForGroupV1Migration(): GroupV1MigrationPropsType {
const invitedGV2Members = this.get('invitedGV2Members') || [];
const droppedGV2MemberIds = this.get('droppedGV2MemberIds') || [];
const migration = this.get('groupMigration');
if (!migration) {
// Backwards-compatibility with data schema in early betas
const invitedGV2Members = this.get('invitedGV2Members') || [];
const droppedGV2MemberIds = this.get('droppedGV2MemberIds') || [];
const invitedMembers = invitedGV2Members.map(item =>
const invitedMembers = invitedGV2Members.map(item =>
this.findAndFormatContact(item.conversationId)
);
const droppedMembers = droppedGV2MemberIds.map(conversationId =>
this.findAndFormatContact(conversationId)
);
return {
areWeInvited: false,
droppedMembers,
invitedMembers,
};
}
const {
areWeInvited,
droppedMemberIds,
invitedMembers: rawInvitedMembers,
} = migration;
const invitedMembers = rawInvitedMembers.map(item =>
this.findAndFormatContact(item.conversationId)
);
const droppedMembers = droppedGV2MemberIds.map(conversationId =>
const droppedMembers = droppedMemberIds.map(conversationId =>
this.findAndFormatContact(conversationId)
);
return {
areWeInvited,
droppedMembers,
invitedMembers,
};