aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/pages/bug/MessageHistoryDialog.tsx
diff options
context:
space:
mode:
authorSascha <GlancingMind@outlook.com>2021-03-19 14:57:11 +0100
committerSascha <GlancingMind@outlook.com>2021-03-19 17:53:12 +0100
commitde9dd698917f905946c5b0e19039e4202375721d (patch)
treeb0d9f18cbd2b5efe1ca2419e5f98d0a8d282d56b /webui/src/pages/bug/MessageHistoryDialog.tsx
parentdfb039a9361a1a0d19a31e25130c89f70828ef00 (diff)
downloadgit-bug-de9dd698917f905946c5b0e19039e4202375721d.tar.gz
Sort history from most recent edit to old
Diffstat (limited to 'webui/src/pages/bug/MessageHistoryDialog.tsx')
-rw-r--r--webui/src/pages/bug/MessageHistoryDialog.tsx5
1 files changed, 4 insertions, 1 deletions
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) {
<Tooltip title={moment(edit.date).format('LLLL')}>
<Moment date={edit.date} format="on ll" />
</Tooltip>
+ {index === 0 && '• (most recent edit)'}
</AccordionSummary>
<AccordionDetails>{edit.message}</AccordionDetails>
</Accordion>