Skip to content

Commit 71cf3f0

Browse files
Copilotalexr00
andcommitted
Add special wording for self-assignment timeline events
When actor and assignee/unassignee are the same person: - Use "assigned themselves" instead of "assigned {user}" - Use "removed their assignment" instead of "unassigned {user}" This aligns the wording with GitHub.com behavior. Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 4f0bc2f commit 71cf3f0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

webviews/components/timeline.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,13 +459,17 @@ const AssignUnassignEventView = ({ event }: { event: AssignEvent | UnassignEvent
459459
const joinedAssignees = joinWithAnd(assignees.map(a => <AuthorLink key={`${a.id}a`} for={a} />));
460460
const joinedUnassignees = joinWithAnd(unassignees.map(a => <AuthorLink key={`${a.id}u`} for={a} />));
461461

462+
// Check if actor is assigning/unassigning themselves
463+
const isSelfAssign = assignees.length === 1 && assignees[0].login === actor.login;
464+
const isSelfUnassign = unassignees.length === 1 && unassignees[0].login === actor.login;
465+
462466
let message: JSX.Element;
463467
if (assignees.length > 0 && unassignees.length > 0) {
464468
message = <>assigned {joinedAssignees} and unassigned {joinedUnassignees}</>;
465469
} else if (assignees.length > 0) {
466-
message = <>assigned {joinedAssignees}</>;
470+
message = isSelfAssign ? <>assigned themselves</> : <>assigned {joinedAssignees}</>;
467471
} else {
468-
message = <>unassigned {joinedUnassignees}</>;
472+
message = isSelfUnassign ? <>removed their assignment</> : <>unassigned {joinedUnassignees}</>;
469473
}
470474

471475
return (

0 commit comments

Comments
 (0)