|
112 | 112 | </NcActionButton> |
113 | 113 | </template> |
114 | 114 | <NcActionButton v-else-if="!board.archived && board.acl?.length > 0" |
115 | | - :name="t('deck', 'Due date reminders')" |
116 | | - :icon="dueDateReminderIcon" |
117 | | - @click="isDueSubmenuActive=true"> |
118 | | - {{ dueDateReminderText }} |
| 115 | + icon="icon-sound" |
| 116 | + @click="openDueReminderMenu"> |
| 117 | + {{ t('deck', 'Due date reminders') }} |
119 | 118 | </NcActionButton> |
120 | 119 |
|
121 | 120 | <NcActionButton v-if="canManage && !isDueSubmenuActive" |
@@ -238,6 +237,7 @@ export default { |
238 | 237 | editColor: '', |
239 | 238 | isDueSubmenuActive: false, |
240 | 239 | updateDueSetting: null, |
| 240 | + loadingDueReminderSettings: false, |
241 | 241 | canCreate: canCreateState, |
242 | 242 | cloneModalOpen: false, |
243 | 243 | exportModalOpen: false, |
@@ -267,25 +267,8 @@ export default { |
267 | 267 | canLeave() { |
268 | 268 | return this.board.acl?.find((acl) => acl.participant.uid === this.currentUser?.uid && acl.participant.type === 0) !== undefined |
269 | 269 | }, |
270 | | - dueDateReminderIcon() { |
271 | | - if (this.board.settings['notify-due'] === 'all') { |
272 | | - return 'icon-sound' |
273 | | - } else if (this.board.settings['notify-due'] === 'assigned') { |
274 | | - return 'icon-user' |
275 | | - } else if (this.board.settings['notify-due'] === 'off') { |
276 | | - return 'icon-sound-off' |
277 | | - } |
278 | | - return '' |
279 | | - }, |
280 | | - dueDateReminderText() { |
281 | | - if (this.board.settings['notify-due'] === 'all') { |
282 | | - return t('deck', 'All cards') |
283 | | - } else if (this.board.settings['notify-due'] === 'assigned') { |
284 | | - return t('deck', 'Only assigned cards') |
285 | | - } else if (this.board.settings['notify-due'] === 'off') { |
286 | | - return t('deck', 'No reminder') |
287 | | - } |
288 | | - return '' |
| 270 | + hasDueDateReminderSetting() { |
| 271 | + return ['all', 'assigned', 'off'].includes(this.board.settings?.['notify-due']) |
289 | 272 | }, |
290 | 273 | isDefaultBoard() { |
291 | 274 | return this.defaultBoardId === String(this.board.id) |
@@ -417,6 +400,24 @@ export default { |
417 | 400 | cancelEdit(e) { |
418 | 401 | this.editing = false |
419 | 402 | }, |
| 403 | + async openDueReminderMenu() { |
| 404 | + this.isDueSubmenuActive = true |
| 405 | +
|
| 406 | + if (this.hasDueDateReminderSetting || this.loadingDueReminderSettings) { |
| 407 | + return |
| 408 | + } |
| 409 | +
|
| 410 | + this.loadingDueReminderSettings = true |
| 411 | +
|
| 412 | + try { |
| 413 | + await this.$store.dispatch('hydrateBoardSettings', this.board.id) |
| 414 | + } catch (error) { |
| 415 | + OC.Notification.showTemporary(t('deck', 'Failed to load due date reminder settings')) |
| 416 | + console.error(error) |
| 417 | + } finally { |
| 418 | + this.loadingDueReminderSettings = false |
| 419 | + } |
| 420 | + }, |
420 | 421 | async updateSetting(key, value) { |
421 | 422 | this.updateDueSetting = value |
422 | 423 | const setting = {} |
|
0 commit comments