Specify ordering filediffs by destFilename (Bug 1248008) r?smacleod draft
authorPiotr Zalewa <pzalewa@mozilla.com>
Thu, 03 Nov 2016 15:01:07 +0100
changeset 205 489b6ccceca0d6a4d49144c9954166dd52adc615
parent 204 79e0a0912247a1eb4a51a68546b1902e242bfeda
push idunknown
push userunknown
push dateunknown
reviewerssmacleod
bugs1248008
Specify ordering filediffs by destFilename (Bug 1248008) r?smacleod Backbone's set function performs a merge of the existing models, rather than fully replacing them (New items are added, missing items are removed, and existing items are merged). It appears this merge operation does not preserve the order of the models which are passed into set (instead the existing items end up before the others). Setting the comparator to destFilename tells the set function to sort by that attribute. MozReview-Commit-ID: 5nNeQQ32Sr4
reviewboard/reviewboard/static/rb/js/diffviewer/collections/diffFileCollection_mozreview.js
--- a/reviewboard/reviewboard/static/rb/js/diffviewer/collections/diffFileCollection_mozreview.js
+++ b/reviewboard/reviewboard/static/rb/js/diffviewer/collections/diffFileCollection_mozreview.js
@@ -1,6 +1,7 @@
 /*
  * A collection of files.
  */
 RB.DiffFileCollection = Backbone.Collection.extend({
-    model: RB.DiffFile
+    model: RB.DiffFile,
+    comparator: 'destFilename'
 });