X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/e0f595e44766e352edfce0aaf5d32be57f448882..491078616e2129745f300c1f0357f5bac52e801d:/src/redakcja/static/js/wiki/wikiapi.js?ds=sidebyside diff --git a/src/redakcja/static/js/wiki/wikiapi.js b/src/redakcja/static/js/wiki/wikiapi.js index 14b8337e..73642ac0 100644 --- a/src/redakcja/static/js/wiki/wikiapi.js +++ b/src/redakcja/static/js/wiki/wikiapi.js @@ -126,8 +126,9 @@ this.fullUri = $("*[data-key='full-uri']", meta).text(); this.text = null; + this.saving = false; this.has_local_changes = false; - this.active = true; + this.active = new Date(); this._lock = -1; this._context_lock = -1; this._lock_count = 0; @@ -216,22 +217,42 @@ checkRevision(params) { /* this doesn't modify anything, so no locks */ var self = this; - let active = self.active; - self.active = false; + let active = new Date() - self.active < 30 * 1000; + let saving = self.saving; $.ajax({ method: "GET", url: reverse("ajax_document_rev", self.id), data: { 'a': active, + 'new': 1, }, - dataType: 'text', + dataType: 'json', success: function(data) { if (data == '') { if (params.error) params.error(); } - else if (data != self.revision) - params.outdated(); + else { + let people = $('