From c38c2cc9041c6219936b084f033a9696a2036102 Mon Sep 17 00:00:00 2001 From: Dragory Date: Sat, 20 Apr 2019 20:15:31 +0300 Subject: [PATCH] Fix case preview in !cases when two or more of the first case notes have the same timestamp --- src/plugins/ModActions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/ModActions.ts b/src/plugins/ModActions.ts index 7714a2ef..43fa266a 100644 --- a/src/plugins/ModActions.ts +++ b/src/plugins/ModActions.ts @@ -8,6 +8,7 @@ import { errorMessage, findRelevantAuditLogEntry, INotifyUserResult, + multiSorter, notifyUser, NotifyUserStatus, stripObjectToScalars, @@ -1272,7 +1273,7 @@ export class ModActionsPlugin extends ZeppelinPlugin { // Compact view (= regular message with a preview of each case) const lines = []; for (const theCase of casesToDisplay) { - theCase.notes.sort((a, b) => (a.created_at > b.created_at ? 1 : -1)); + theCase.notes.sort(multiSorter(["created_at", "id"])); const caseSummary = this.cases.getSummaryText(theCase); lines.push(caseSummary); }