buddy-workbench 0.2.14 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -443,7 +443,14 @@ router.get('/recently-commented', async (_req, res) => {
|
|
|
443
443
|
|
|
444
444
|
const myComments = comments.filter((c) => isAuthorMatch(c.author || c.updateAuthor, identity));
|
|
445
445
|
if (myComments.length > 0) {
|
|
446
|
-
|
|
446
|
+
// A comment's updated timestamp changes when an older comment is edited.
|
|
447
|
+
// Recently Commented should follow the time the comment was posted, so
|
|
448
|
+
// an edit cannot make an old comment appear newer than a later comment.
|
|
449
|
+
myComments.sort((a, b) => {
|
|
450
|
+
const aCreated = new Date(a.created || a.updated || 0).getTime();
|
|
451
|
+
const bCreated = new Date(b.created || b.updated || 0).getTime();
|
|
452
|
+
return bCreated - aCreated;
|
|
453
|
+
});
|
|
447
454
|
const latestMyComment = myComments[0];
|
|
448
455
|
const bodyText = extractCommentBodyText(latestMyComment.body);
|
|
449
456
|
const commentSnippet = bodyText.slice(0, 140).replace(/\r?\n+/g, ' ');
|
|
@@ -456,7 +463,7 @@ router.get('/recently-commented', async (_req, res) => {
|
|
|
456
463
|
priority: fields.priority?.name || '',
|
|
457
464
|
status: fields.status?.name || '',
|
|
458
465
|
commentSnippet,
|
|
459
|
-
commentedAt: latestMyComment.
|
|
466
|
+
commentedAt: latestMyComment.created || latestMyComment.updated || fields.updated,
|
|
460
467
|
url: `https://${jiraHost}/browse/${key}${commentId ? `?focusedCommentId=${commentId}#comment-${commentId}` : ''}`
|
|
461
468
|
};
|
|
462
469
|
}
|