From de9dd698917f905946c5b0e19039e4202375721d Mon Sep 17 00:00:00 2001 From: Sascha Date: Fri, 19 Mar 2021 14:57:11 +0100 Subject: Sort history from most recent edit to old --- webui/src/pages/bug/MessageHistoryDialog.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'webui') diff --git a/webui/src/pages/bug/MessageHistoryDialog.tsx b/webui/src/pages/bug/MessageHistoryDialog.tsx index 9857f272..dc0e09cb 100644 --- a/webui/src/pages/bug/MessageHistoryDialog.tsx +++ b/webui/src/pages/bug/MessageHistoryDialog.tsx @@ -169,7 +169,9 @@ function MessageHistoryDialog({ bugId, commentId, open, onClose }: Props) { // NOTE Searching for the changed comment could be dropped if GraphQL get // filter by id argument for timelineitems const comment = comments.find((elem) => elem.id === commentId); - const history = comment?.history; + // Sort by most recent edit. Must create a copy of constant history as + // reverse() modifies inplace. + const history = comment?.history.slice().reverse(); const handleChange = (panel: string) => ( event: React.ChangeEvent<{}>, @@ -203,6 +205,7 @@ function MessageHistoryDialog({ bugId, commentId, open, onClose }: Props) { + {index === 0 && '• (most recent edit)'} {edit.message} -- cgit