Skip to content

Commit 34ae85d

Browse files
Copilotalexr00
andauthored
Use reflexive wording for self-assignment timeline events (#8286)
* Initial plan * 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> * Handle self-assignment in mixed assignment/unassignment events Also apply special wording for self-assignment when both assignments and unassignments occur in the same consolidated event. Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Refactor to reduce code duplication in AssignUnassignEventView Extract joinedAssignees and joinedUnassignees into variables to avoid repeating the joinWithAnd expressions and improve maintainability. Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Better match GitHub's language --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 3e96e22 commit 34ae85d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

webviews/components/timeline.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,13 +459,20 @@ 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) {
464-
message = <>assigned {joinedAssignees} and unassigned {joinedUnassignees}</>;
468+
// Handle mixed case with potential self-assignment
469+
const assignMessage = isSelfAssign ? <>self-assigned this</> : <>assigned {joinedAssignees}</>;
470+
const unassignMessage = isSelfUnassign ? <>removed their assignment</> : <>unassigned {joinedUnassignees}</>;
471+
message = <>{assignMessage} and {unassignMessage}</>;
465472
} else if (assignees.length > 0) {
466-
message = <>assigned {joinedAssignees}</>;
473+
message = isSelfAssign ? <>self-assigned this</> : <>assigned {joinedAssignees}</>;
467474
} else {
468-
message = <>unassigned {joinedUnassignees}</>;
475+
message = isSelfUnassign ? <>removed their assignment</> : <>unassigned {joinedUnassignees}</>;
469476
}
470477

471478
return (

0 commit comments

Comments
 (0)