diff --git a/changelog.d/fixed-16580-viewer-signoff-match.md b/changelog.d/fixed-16580-viewer-signoff-match.md new file mode 100644 index 0000000000..45e8c01758 --- /dev/null +++ b/changelog.d/fixed-16580-viewer-signoff-match.md @@ -0,0 +1 @@ +- Activity Monitor: a sign-off question naming `@clubanderson-bot` or `@clubandersonx` no longer reads "needs your sign-off" to the viewer `clubanderson`; the viewer's handle is matched on a word boundary. diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index c991e7b18d..f8076f32d9 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -769,6 +769,8 @@ test('#16484: count grammar — CI passed/total and Review done/total across eve try { assert.equal(review('human_decision', {}, { decision_needed: { question: '@clubanderson should decide whether to accept this workflow change from a fork.' } }), 'Review 3/5 · needs your sign-off', 'the ask names the viewer'); assert.equal(review('human_decision', {}, { decision_needed: { question: '@someone-else should decide.' } }), 'Review 3/5 · needs owner sign-off'); + for (const q of ['@clubanderson-bot should decide.', '@clubandersonx should decide.']) assert.equal(review('human_decision', {}, { decision_needed: { question: q } }), 'Review 3/5 · needs owner sign-off', 'a longer login is not the viewer: ' + q); + for (const q of ['@clubanderson', 'ping @clubanderson, please decide.', 'ok @ClubAnderson?']) assert.equal(review('human_decision', {}, { decision_needed: { question: q } }), 'Review 3/5 · needs your sign-off', 'the viewer handle ends at punctuation or the end: ' + q); } finally { delete globalThis.window; } assert.equal(review('reviewing', { actor: 'reviewer-2' }), 'Review 3/5 · reviewer-2 reviewing'); assert.equal(review('adjudicating', { actor: 'adjudicator' }), 'Review 3/5 · adjudicator reviewing'); diff --git a/src/pkg/dashboard/static-src/js/tracker-row-strip.js b/src/pkg/dashboard/static-src/js/tracker-row-strip.js index b4d8b06c88..fb46b2cd8e 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -88,7 +88,7 @@ if (stageTrackerHiveOwnsRepair(item)) return count + ' · changes requested'; const q = item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question).toLowerCase() : ''; const me = typeof window !== 'undefined' && window._hiveUser ? String(window._hiveUser).toLowerCase() : ''; - const mine = !!me && q.indexOf('@' + me) >= 0; + const mine = !!me && new RegExp('@' + me.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?![\\w-])').test(q); return count + (mine ? ' · needs your sign-off' : ' · needs owner sign-off'); } case 'reviewing': case 'adjudicating': return count + ' · ' + (actor ? actor + ' reviewing' : 'reviewing'); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 57555e2301..b280f33937 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -18188,7 +18188,7 @@

Where to get help

if (stageTrackerHiveOwnsRepair(item)) return count + ' · changes requested'; const q = item.decision_needed && item.decision_needed.question ? String(item.decision_needed.question).toLowerCase() : ''; const me = typeof window !== 'undefined' && window._hiveUser ? String(window._hiveUser).toLowerCase() : ''; - const mine = !!me && q.indexOf('@' + me) >= 0; + const mine = !!me && new RegExp('@' + me.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?![\\w-])').test(q); return count + (mine ? ' · needs your sign-off' : ' · needs owner sign-off'); } case 'reviewing': case 'adjudicating': return count + ' · ' + (actor ? actor + ' reviewing' : 'reviewing');