From c697013932b69c4f6e2cc0045e4095c18bc49f12 Mon Sep 17 00:00:00 2001 From: ValenberghsSven Date: Mon, 22 Mar 2021 15:39:37 +0100 Subject: [PATCH] KAS-2113 reload data before approving agenda --- .../agenda/agenda-header/component.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/pods/components/agenda/agenda-header/component.js b/app/pods/components/agenda/agenda-header/component.js index 22857e8e4d..23461a92ff 100644 --- a/app/pods/components/agenda/agenda-header/component.js +++ b/app/pods/components/agenda/agenda-header/component.js @@ -496,6 +496,20 @@ export default Component.extend(FileSaverMixin, { } }, + /** + * ensureAgendaDataIsRecent + * + * This method will reload the agendaitems of the current agenda and show a loader while in progress + * Any new agendaitem or changed formallity is picked up by this, preventing the triggering the relevant agenda actions with stale date + * created by concurrent edits of agendaitem formally ok status by other uses + * + */ + async ensureAgendaDataIsRecent() { + this.toggleLoadingOverlayWithMessage(this.intl.t('agendaitems-loading-text')); + await this.currentAgenda.hasMany('agendaitems').reload(); + this.toggleLoadingOverlayWithMessage(null); + }, + actions: { print() { window.print(); @@ -656,7 +670,8 @@ export default Component.extend(FileSaverMixin, { this.toggleProperty('editingSession'); }, - openConfirmApproveAgenda() { + async openConfirmApproveAgenda() { + await this.ensureAgendaDataIsRecent(); this.set('showConfirmForApprovingAgenda', true); }, @@ -669,7 +684,8 @@ export default Component.extend(FileSaverMixin, { this.set('showConfirmForApprovingAgenda', false); }, - openConfirmApproveAgendaAndCloseMeeting() { + async openConfirmApproveAgendaAndCloseMeeting() { + await this.ensureAgendaDataIsRecent(); this.set('showConfirmForApprovingAgendaAndClosingMeeting', true); },