MozReview: Return `FileDiff` list sorted by default model sorting (pk)
Bug 1248008 r?smacleod
MozReview is adding a commit message `FileDiff` which has to be displayed as the
first one from the set. Sorting by dest_filename would be causing issues when
paging is involved.
MozReview-Commit-ID: 4iQs3hBbfSC
--- a/reviewboard/reviewboard/diffviewer/diffutils.py
+++ b/reviewboard/reviewboard/diffviewer/diffutils.py
@@ -399,20 +399,22 @@ def get_diff_files(diffset, filediff=Non
if force_interdiff:
f['force_interdiff_revision'] = interdiffset.revision
files.append(f)
log_timer.done()
- if len(files) == 1:
- return files
- else:
- return get_sorted_filediffs(files, key=lambda f: f['filediff'])
+ # MozReview is adding a commit message filediff which has to be the first
+ # from the set. Sorting by dest_filename would cause issues when paging
+ # is involved. Since the filediff's are already in a logical order when
+ # sorted by id (which they should be here) removing this sort shouldn't
+ # make UX worse.
+ return files
def populate_diff_chunks(files, enable_syntax_highlighting=True,
request=None):
"""Populates a list of diff files with chunk data.
This accepts a list of files (generated by get_diff_files) and generates
diff chunk data for each file in the list. The chunk data is stored in