From: Aleksander Ɓukasz Date: Mon, 30 Dec 2013 09:30:11 +0000 (+0100) Subject: Don't set has_local_changes document flag unnecessarily, fixes #3234 X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/c3f7497f5070c9b317a963a2db6cfe5880ff8d15?hp=995d7d01ab2f1a0a378fcf180f069845a454689a Don't set has_local_changes document flag unnecessarily, fixes #3234 --- diff --git a/redakcja/static/js/wiki/wikiapi.js b/redakcja/static/js/wiki/wikiapi.js index d901e847..8df3ef5a 100644 --- a/redakcja/static/js/wiki/wikiapi.js +++ b/redakcja/static/js/wiki/wikiapi.js @@ -227,16 +227,24 @@ * Set document's text */ WikiDocument.prototype.setText = function(text) { - this.text = text; - this.has_local_changes = true; + return this.setDocumentProperty('text', text); }; /* * Set document's gallery link */ WikiDocument.prototype.setGalleryLink = function(gallery) { - this.galleryLink = gallery; - this.has_local_changes = true; + return this.setDocumentProperty('galleryLink', gallery); + }; + + /* + * Set document's property + */ + WikiDocument.prototype.setDocumentProperty = function(property, value) { + if(this[property] !== value) { + this[property] = value; + this.has_local_changes = true; + } }; /*