Skip to content

Commit

Permalink
feat: handle connection requests errors (WPB-4418)
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Gira committed Sep 11, 2023
1 parent 17d3f6e commit b82527c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,9 @@
"modalUserBlockMessage": "{{user}} won’t be able to contact you or add you to group conversations.",
"modalUserBlockedForLegalHold": "This user is blocked due to legal hold. [link]Learn more[/link]",
"modalUserCannotBeAddedHeadline": "Guests cannot be added",
"modalUserCannotConnectLegalHoldHeadline": "Cannot connect to this user",
"modalUserCannotConnectHeadline": "Connecting not possible",
"modalUserCannotConnectMessage": "Connection request could not be sent",
"modalUserCannotConnectLegalHoldMessage": "You cannot connect to this user due to legal hold. [link]Learn more[/link]",
"modalUserCannotConnectNotFederatingHeadline": "Connecting not possible",
"modalUserCannotConnectNotFederatingMessage": "You can’t send a connection request as your backend doesn’t federate with the one of {{username}}.",
"modalUserLearnMore": "Learn more",
"modalUserUnblockAction": "Unblock",
Expand Down
11 changes: 9 additions & 2 deletions src/script/connection/ConnectionRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class ConnectionRepository {
PrimaryModal.show(PrimaryModal.type.ACKNOWLEDGE, {
text: {
htmlMessage: t('modalUserCannotConnectLegalHoldMessage', {}, replaceLinkLegalHold),
title: t('modalUserCannotConnectLegalHoldHeadline'),
title: t('modalUserCannotConnectHeadline'),
},
});
break;
Expand All @@ -212,14 +212,21 @@ export class ConnectionRepository {
PrimaryModal.show(PrimaryModal.type.ACKNOWLEDGE, {
text: {
htmlMessage: t('modalUserCannotConnectNotFederatingMessage', userEntity.name()),
title: t('modalUserCannotConnectNotFederatingHeadline'),
title: t('modalUserCannotConnectHeadline'),
},
});
break;
}

default: {
this.logger.error(`Failed to send connection request to user '${userEntity.id}': ${error.message}`, error);
PrimaryModal.show(PrimaryModal.type.ACKNOWLEDGE, {
text: {
htmlMessage: t('modalUserCannotConnectMessage', userEntity.name()),
title: t('modalUserCannotConnectHeadline'),
},
});
break;
}
}
return false;
Expand Down

0 comments on commit b82527c

Please sign in to comment.