From 7428199fdd170906fc48df57100b5159e368a42b Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Wed, 21 Nov 2018 11:53:12 +0000 Subject: [PATCH] Handle edge case of self-approving sections changes Prevents double-submission bug leading to section being hidden from view. --- gui/app/pods/document/index/controller.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gui/app/pods/document/index/controller.js b/gui/app/pods/document/index/controller.js index 7ada5c56..5fa2bcfb 100644 --- a/gui/app/pods/document/index/controller.js +++ b/gui/app/pods/document/index/controller.js @@ -83,9 +83,17 @@ export default Controller.extend(Tooltips, Notifier, { let documentId = document.get('id'); let constants = this.get('constants'); - // if document approval mode is locked return + // Cannot change locked documents. if (document.get('protection') === constants.ProtectionType.Lock) { - // should not really happen + return; + } + + // Detect stale data situation and reload page. + // Happens when you are saving section edits that + // has just been approved. + // TODO: really need a better way than this + if (page.get('id') === page.get('relativeId')) { + window.location.reload(); return; }