X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/e0f595e44766e352edfce0aaf5d32be57f448882..309ec8b919d57858254b78cd7ba3b4d84d90da9a:/src/redakcja/static/js/wiki/wikiapi.js 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 = $('