diff options
author | Mert Tumer <mert.tumer@collabora.com> | 2021-11-26 12:45:42 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-11-30 10:13:24 +0100 |
commit | 6ec2992ff9577e8f568d732c6ad3a232643b9b1d (patch) | |
tree | 377aa8bd361d7b1f2e4cb7bda0f3329735e17032 | |
parent | xlsb type should be readonly and added option to saveas odf (diff) | |
download | online-6ec2992ff9577e8f568d732c6ad3a232643b9b1d.tar.gz online-6ec2992ff9577e8f568d732c6ad3a232643b9b1d.zip |
fix: dont give an option to saveas if UserCannotWriteRelative is true
On documentconflict, we give 3 options;
discard, overwrite, save-as
the third option should be impossible if the user is not allowed
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I30571d885259a02c4170ccf7e291d4456bf1880c
-rw-r--r-- | loleaflet/src/core/Socket.js | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index f58fced393..6c531c9a48 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -824,27 +824,32 @@ app.definitions.Socket = L.Class.extend({ vex.closeAll(); + var dialogButtons = [ + $.extend({}, vex.dialog.buttons.YES, { text: _('Discard'), + click: function() { + this.value = 'discard'; + this.close(); + }}), + $.extend({}, vex.dialog.buttons.YES, { text: _('Overwrite'), + click: function() { + this.value = 'overwrite'; + this.close(); + }}) + ]; + + if (!that._map['wopi'].UserCanNotWriteRelative) { + dialogButtons.push($.extend({}, vex.dialog.buttons.YES, { text: _('Save to new file'), + click: function() { + this.value = 'saveas'; + this.close(); + }})); + } + vex.dialog.open({ message: _('Document has been changed in storage. What would you like to do with your unsaved changes?'), escapeButtonCloses: false, overlayClosesOnClick: false, - buttons: [ - $.extend({}, vex.dialog.buttons.YES, { text: _('Discard'), - click: function() { - this.value = 'discard'; - this.close(); - }}), - $.extend({}, vex.dialog.buttons.YES, { text: _('Overwrite'), - click: function() { - this.value = 'overwrite'; - this.close(); - }}), - $.extend({}, vex.dialog.buttons.YES, { text: _('Save to new file'), - click: function() { - this.value = 'saveas'; - this.close(); - }}) - ], + buttons: dialogButtons, callback: function(value) { if (value === 'discard') { // They want to refresh the page and load document again for all |