From c3f7497f5070c9b317a963a2db6cfe5880ff8d15 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 30 Dec 2013 10:30:11 +0100 Subject: [PATCH] Don't set has_local_changes document flag unnecessarily, fixes #3234 --- redakcja/static/js/wiki/wikiapi.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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; + } }; /* -- 2.20.1