Fix sorting of bundled notifications

This commit is contained in:
Jason McBrayer 2019-11-08 10:24:10 -05:00
parent 428c1e1508
commit f6d0cfee61

View File

@ -640,12 +640,15 @@ def note(request, next=None, prev=None):
return str(note.status.id) + note.type return str(note.status.id) + note.type
except: except:
return str(note.id) + note.type return str(note.id) + note.type
def group_sort_key(group):
return max([k.id for k in group])
sorted_notes = sorted(notes, key=bundle_key, reverse=True) sorted_notes = sorted(notes, key=bundle_key, reverse=True)
for _, group in groupby(sorted_notes, bundle_key): for _, group in groupby(sorted_notes, bundle_key):
group = LabeledList(group) group = LabeledList(group)
group.accounts = [x.account for x in group] group.accounts = [x.account for x in group]
groups.append(group) groups.append(group)
groups.sort(key=group_sort_key, reverse=True)
else: else:
groups.append(notes) groups.append(notes)