Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2020-01-12 21:04:05 +0300
committerdartcafe <github@dartcafe.de>2020-01-12 21:04:05 +0300
commit78f4291466447b31dcad9ee930a3fa9a01cfd8ce (patch)
tree8a33ff771b3991be6214babda6cd69ea99a3496f /src/js/store/modules/shares.js
parent7f00840cd48c08001f732aceb2e09aa8ba001d91 (diff)
enhanced error handling of invitation mails for groups
Diffstat (limited to 'src/js/store/modules/shares.js')
-rw-r--r--src/js/store/modules/shares.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/js/store/modules/shares.js b/src/js/store/modules/shares.js
index 34e71d70..e0b653a3 100644
--- a/src/js/store/modules/shares.js
+++ b/src/js/store/modules/shares.js
@@ -129,7 +129,34 @@ const actions = {
return axios.post(OC.generateUrl(endPoint), { pollId: context.rootState.poll.id, share: payload.share })
.then((response) => {
context.commit('addShare', response.data.share)
- return response.data.mailSent
+
+ if (response.data.sendResult.sentMails.length > 0) {
+ const sendList = response.data.sendResult.sentMails.map(element => {
+
+ if (element.displayName) {
+ return element.displayName
+ } else if (element.userId) {
+ return element.userId
+ } else if (element.eMailAddress) {
+ return element.eMailAddress
+ }
+ })
+ OC.Notification.showTemporary(t('polls', 'Invitation mail sent to %n.', 1, sendList.join(', ')), { type: 'success' })
+ }
+
+ if (response.data.sendResult.abortedMails.length > 0) {
+ const errorList = response.data.sendResult.abortedMails.map(element => {
+ if (element.displayName) {
+ return element.displayName
+ } else if (element.userId) {
+ return element.userId
+ } else if (element.eMailAddress) {
+ return element.eMailAddress
+ }
+ })
+ OC.Notification.showTemporary(t('polls', 'Error sending invitation mail to %n.', 1, errorList.join(', ')), { type: 'error' })
+ }
+ return response.data
}, (error) => {
console.error('Error writing share', { error: error.response }, { payload: payload })
throw error