X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/32ee10aaf4c035a199a96c06bd2506befed5e17f..309ec8b919d57858254b78cd7ba3b4d84d90da9a:/src/redakcja/static/js/wiki/wikiapi.js?ds=inline diff --git a/src/redakcja/static/js/wiki/wikiapi.js b/src/redakcja/static/js/wiki/wikiapi.js index 4a28d630..73642ac0 100644 --- a/src/redakcja/static/js/wiki/wikiapi.js +++ b/src/redakcja/static/js/wiki/wikiapi.js @@ -126,6 +126,7 @@ this.fullUri = $("*[data-key='full-uri']", meta).text(); this.text = null; + this.saving = false; this.has_local_changes = false; this.active = new Date(); this._lock = -1; @@ -217,6 +218,7 @@ /* this doesn't modify anything, so no locks */ var self = this; let active = new Date() - self.active < 30 * 1000; + let saving = self.saving; $.ajax({ method: "GET", url: reverse("ajax_document_rev", self.id), @@ -247,7 +249,7 @@ }); $("#people").html(people); - if (data.rev != self.revision) { + if (!saving && (data.rev != self.revision)) { params.outdated(); } } @@ -375,6 +377,7 @@ data['textsave-text'] = self.text; + self.saving = true; $.ajax({ url: reverse("ajax_document_text", self.id), type: "POST", @@ -392,10 +395,12 @@ changed = true; self.triggerDocumentChanged(); }; + self.saving = false; params['success'](self, changed, ((changed && "Udało się zapisać :)") || "Twoja wersja i serwera jest identyczna")); }, error: function(xhr) { + self.saving = false; if ($('#header').hasClass('saving')) { $('#header').removeClass('saving'); $.blockUI({