Skip to content

Commit

Permalink
Support for GV1 -> GV2 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal authored and josh-signal committed Nov 23, 2020
1 parent a0baa3e commit 2c69f2c
Show file tree
Hide file tree
Showing 32 changed files with 2,612 additions and 327 deletions.
98 changes: 97 additions & 1 deletion _locales/en/messages.json
Expand Up @@ -3140,7 +3140,7 @@
"message": "Please try again or contact support.",
"description": "Description text in pop-up dialog when user-initiated task has gone wrong"
},
"ErrorModal--buttonText": {
"Confirmation--confirm": {
"message": "Okay",
"description": "Button to dismiss pop-up dialog when user-initiated task has gone wrong"
},
Expand Down Expand Up @@ -3960,6 +3960,102 @@
}
}
},
"GroupV1--Migration--was-upgraded": {
"message": "This group was upgraded to a New Group.",
"description": "Shown in timeline when a legacy group (GV1) is upgraded to a new group (GV2)"
},
"GroupV1--Migration--learn-more": {
"message": "Learn More",
"description": "Shown on a bubble below a 'group was migrated' timeline notification, or as button on Migrate dialog"
},
"GroupV1--Migration--migrate": {
"message": "Migrate",
"description": "Shown on Migrate dialog to kick off the process"
},
"GroupV1--Migration--info--title": {
"message": "What are New Groups?",
"description": "Shown on Learn More popup after GV1 migration"
},
"GroupV1--Migration--migrate--title": {
"message": "Upgrade to New Group",
"description": "Shown on Migration popup after choosing to migrate group"
},
"GroupV1--Migration--info--summary": {
"message": "New Groups have features like @mentions and group admins, and will support more features in the future.",
"description": "Shown on Learn More popup after or Migration popup before GV1 migration"
},
"GroupV1--Migration--info--keep-history": {
"message": "All message history and media has been kept from before the upgrade.",
"description": "Shown on Learn More popup after GV1 migration"
},
"GroupV1--Migration--migrate--keep-history": {
"message": "All message history and media will be kept from before the upgrade.",
"description": "Shown on Migration popup before GV1 migration"
},
"GroupV1--Migration--info--invited--many": {
"message": "These members will need to accept an invite to join this group again, and will not receive group messages until they accept:",
"description": "Shown on Learn More popup after or Migration popup before GV1 migration"
},
"GroupV1--Migration--info--invited--one": {
"message": "This member will need to accept an invite to join this group again, and will not receive group messages until they accept:",
"description": "Shown on Learn More popup after or Migration popup before GV1 migration"
},
"GroupV1--Migration--info--removed--before--many": {
"message": "These members are not capable of joining New Groups, and will be removed from the group:",
"description": "Shown on Learn More popup after or Migration popup before GV1 migration"
},
"GroupV1--Migration--info--removed--before--one": {
"message": "This member is not capable of joining New Groups, and will be removed from the group:",
"description": "Shown on Learn More popup after or Migration popup before GV1 migration"
},
"GroupV1--Migration--info--removed--after--many": {
"message": "These members were not capable of joining New Groups, and were removed from the group:",
"description": "Shown on Learn More popup after or Migration popup before GV1 migration"
},
"GroupV1--Migration--info--removed--after--one": {
"message": "This member was not capable of joining New Groups, and was removed from the group:",
"description": "Shown on Learn More popup after or Migration popup before GV1 migration"
},
"GroupV1--Migration--invited--one": {
"message": "$contact$ couldn’t be added to the New Group and has been invited to join.",
"description": "Shown in timeline when a group is upgraded and one person was invited, instead of added",
"placeholders": {
"contact": {
"content": "$1",
"example": "5"
}
}
},
"GroupV1--Migration--invited--many": {
"message": "$count$ members couldn’t be added to the New Group and have been invited to join.",
"description": "Shown in timeline when a group is upgraded and some people were invited, instead of added",
"placeholders": {
"contact": {
"content": "$1",
"example": "5"
}
}
},
"GroupV1--Migration--removed--one": {
"message": "$contact$ was removed from the group.",
"description": "Shown in timeline when a group is upgraded and one person was removed entirely during the upgrade",
"placeholders": {
"contact": {
"content": "$1",
"example": "5"
}
}
},
"GroupV1--Migration--removed--many": {
"message": "$count$ members were removed from the group.",
"description": "Shown in timeline when a group is upgraded and some people were removed entirely during the upgrade",
"placeholders": {
"contact": {
"content": "$1",
"example": "5"
}
}
},
"close": {
"message": "Close",
"description": "Generic close label"
Expand Down
55 changes: 37 additions & 18 deletions js/message_requests.js
Expand Up @@ -20,9 +20,7 @@
});
if (syncByE164) {
window.log.info(
`Found early message request response for E164 ${conversation.get(
'e164'
)}`
`Found early message request response for E164 ${conversation.idForLogging()}`
);
this.remove(syncByE164);
return syncByE164;
Expand All @@ -35,24 +33,35 @@
});
if (syncByUuid) {
window.log.info(
`Found early message request response for UUID ${conversation.get(
'uuid'
)}`
`Found early message request response for UUID ${conversation.idForLogging()}`
);
this.remove(syncByUuid);
return syncByUuid;
}
}

// V1 Group
if (conversation.get('groupId')) {
const syncByGroupId = this.findWhere({
groupId: conversation.get('groupId'),
});
if (syncByGroupId) {
window.log.info(
`Found early message request response for GROUP ID ${conversation.get(
'groupId'
)}`
`Found early message request response for group v1 ID ${conversation.idForLogging()}`
);
this.remove(syncByGroupId);
return syncByGroupId;
}
}

// V2 group
if (conversation.get('groupId')) {
const syncByGroupId = this.findWhere({
groupV2Id: conversation.get('groupId'),
});
if (syncByGroupId) {
window.log.info(
`Found early message request response for group v2 ID ${conversation.idForLogging()}`
);
this.remove(syncByGroupId);
return syncByGroupId;
Expand All @@ -66,19 +75,29 @@
const threadE164 = sync.get('threadE164');
const threadUuid = sync.get('threadUuid');
const groupId = sync.get('groupId');
const groupV2Id = sync.get('groupV2Id');

let conversation;

const conversation = groupId
? ConversationController.get(groupId)
: ConversationController.get(
ConversationController.ensureContactIds({
e164: threadE164,
uuid: threadUuid,
})
);
// We multiplex between GV1/GV2 groups here, but we don't kick off migrations
if (groupV2Id) {
conversation = ConversationController.get(groupV2Id);
}
if (!conversation && groupId) {
conversation = ConversationController.get(groupId);
}
if (!conversation && (threadE164 || threadUuid)) {
conversation = ConversationController.get(
ConversationController.ensureContactIds({
e164: threadE164,
uuid: threadUuid,
})
);
}

if (!conversation) {
window.log(
`Received message request response for unknown conversation: ${groupId} ${threadUuid} ${threadE164}`
`Received message request response for unknown conversation: groupv2(${groupV2Id}) group(${groupId}) ${threadUuid} ${threadE164}`
);
return;
}
Expand Down
115 changes: 115 additions & 0 deletions stylesheets/_mixins.scss
Expand Up @@ -190,3 +190,118 @@
outline: inherit;
text-align: inherit;
}

// Buttons

@mixin button-primary {
background-color: $ultramarine-ui-light;

// Note: the background colors here need to match the parent component
@include light-theme {
color: $color-white;
border: 1px solid white;
}
@include dark-theme {
color: $color-white-alpha-90;
border: 1px solid $color-gray-95;
}

&:hover {
@include mouse-mode {
background-color: mix($color-black, $ultramarine-ui-light, 15%);
}

@include dark-mouse-mode {
background-color: mix($color-white, $ultramarine-ui-light, 15%);
}
}

&:active {
@include light-theme {
background-color: mix($color-black, $ultramarine-ui-light, 25%);
}

@include dark-theme {
background-color: mix($color-white, $ultramarine-ui-light, 25%);
}
}

&:focus {
@include keyboard-mode {
box-shadow: 0px 0px 0px 3px $ultramarine-ui-light;
}
@include dark-keyboard-mode {
box-shadow: 0px 0px 0px 3px $ultramarine-ui-dark;
}
}
}

@mixin button-secondary {
@include light-theme {
color: $color-gray-90;
background-color: $color-gray-05;
}
@include dark-theme {
color: $color-gray-05;
background-color: $color-gray-65;
}

&:hover {
@include mouse-mode {
background-color: mix($color-black, $color-gray-05, 15%);
}

@include dark-mouse-mode {
background-color: mix($color-white, $color-gray-65, 15%);
}
}

&:active {
@include light-theme {
background-color: mix($color-black, $color-gray-05, 25%);
}

@include dark-theme {
background-color: mix($color-white, $color-gray-65, 25%);
}
}
}
@mixin button-secondary-blue-text {
@include light-theme {
color: $ultramarine-ui-light;
}
@include dark-theme {
color: $ultramarine-ui-dark;
}
}

@mixin button-destructive {
@include light-theme {
color: $color-white;
background-color: $color-accent-red;
}
@include dark-theme {
color: $color-white-alpha-90;
background-color: $color-accent-red;
}

&:hover {
@include mouse-mode {
background-color: mix($color-black, $color-accent-red, 15%);
}

@include dark-mouse-mode {
background-color: mix($color-white, $color-accent-red, 15%);
}
}

&:active {
@include light-theme {
background-color: mix($color-black, $color-accent-red, 25%);
}

@include dark-theme {
background-color: mix($color-white, $color-accent-red, 25%);
}
}
}

0 comments on commit 2c69f2c

Please sign in to comment.