Skip to content

Commit 689a752

Browse files
committed
fix: nits
1 parent 1b23b98 commit 689a752

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

i18n/en-US.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ be.contentSharing.noAccessError = You do not have access to this item.
149149
# Message that appears when the item for the ContentSharing Element cannot be found.
150150
be.contentSharing.notFoundError = Could not find shared link for this item.
151151
# Message that appears when collaborators cannot be added to the shared link in the ContentSharing Element.
152-
be.contentSharing.sendInvitationsError = { count, plural, one { Failed to invite a collaborator. } other { Failed to invite {count} collaborators. }}
152+
be.contentSharing.sendInvitationsError = {count, plural, one {Failed to invite a collaborator.} other {Failed to invite {count} collaborators.}}
153153
# Message that appears when collaborators were added to the shared link in the ContentSharing Element.
154-
be.contentSharing.sendInvitationsSuccess = { count, plural, one { Successfully invited a collaborator. } other { Successfully invited {count} collaborators. }}
154+
be.contentSharing.sendInvitationsSuccess = {count, plural, one {Successfully invited a collaborator.} other {Successfully invited {count} collaborators.}}
155155
# Message that appears when collaborators cannot be added to the shared link in the ContentSharing Element.
156156
be.contentSharing.sendInvitesError = Could not send invites.
157157
# Message that appears when collaborators were added to the shared link in the ContentSharing Element.

src/elements/content-sharing/hooks/useSharingService.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,26 @@ export const useSharingService = ({
101101
transformRequest: data => convertCollabsRequest(data, collaborators),
102102
});
103103

104-
const sendInvitations = (...args) => {
105-
return handleSendInvitations(...args).then(result => {
106-
if (!result || args[0].contacts.length === 0) {
104+
const sendInvitations = (...request) => {
105+
return handleSendInvitations(...request).then(response => {
106+
const { contacts: collabRequest } = request[0];
107+
if (!response || !collabRequest || collabRequest.length === 0) {
107108
return null;
108109
}
109110

111+
const successCount = response.length;
112+
const errorCount = collabRequest.length - successCount;
113+
110114
const notification = [];
111-
if (result.length === 0 || result.length < args[0].contacts.length) {
115+
if (errorCount > 0) {
112116
notification.push({
113-
text: formatMessage(messages.sendInvitationsError, {
114-
count: args[0].contacts.length - result.length,
115-
}),
117+
text: formatMessage(messages.sendInvitationsError, { count: errorCount }),
116118
type: 'error',
117119
});
118120
}
119-
if (result.length <= args[0].contacts.length && result.length > 0) {
121+
if (successCount > 0) {
120122
notification.push({
121-
text: formatMessage(messages.sendInvitationsSuccess, { count: result.length }),
123+
text: formatMessage(messages.sendInvitationsSuccess, { count: successCount }),
122124
type: 'success',
123125
});
124126
}

src/elements/content-sharing/messages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ const messages = defineMessages({
6161
},
6262
sendInvitationsError: {
6363
defaultMessage:
64-
'{ count, plural, one { Failed to invite a collaborator. } other { Failed to invite {count} collaborators. }}',
64+
'{count, plural, one {Failed to invite a collaborator.} other {Failed to invite {count} collaborators.}}',
6565
description:
6666
'Message that appears when collaborators cannot be added to the shared link in the ContentSharing Element.',
6767
id: 'be.contentSharing.sendInvitationsError',
6868
},
6969
sendInvitationsSuccess: {
7070
defaultMessage:
71-
'{ count, plural, one { Successfully invited a collaborator. } other { Successfully invited {count} collaborators. }}',
71+
'{count, plural, one {Successfully invited a collaborator.} other {Successfully invited {count} collaborators.}}',
7272
description:
7373
'Message that appears when collaborators were added to the shared link in the ContentSharing Element.',
7474
id: 'be.contentSharing.sendInvitationsSuccess',

0 commit comments

Comments
 (0)