fix: default comment reassign to last commenter who isn't me

When commenting on an issue, the reassign dropdown now defaults to the
last commenter who is not the current user, preventing accidental
self-reassignment. Falls back to the current issue assignee if no
other commenters exist.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dotta
2026-03-18 16:30:59 -05:00
parent 9c5a31ed45
commit 915a3ff3ce

View File

@@ -376,10 +376,20 @@ export function IssueDetail() {
}, [agents, currentUserId]);
const currentAssigneeValue = useMemo(() => {
// Default to the last commenter who is not "me" so the user doesn't
// accidentally reassign to themselves when commenting on their own issue.
if (comments && comments.length > 0 && currentUserId) {
for (let i = comments.length - 1; i >= 0; i--) {
const c = comments[i];
if (c.authorAgentId) return `agent:${c.authorAgentId}`;
if (c.authorUserId && c.authorUserId !== currentUserId)
return `user:${c.authorUserId}`;
}
}
if (issue?.assigneeAgentId) return `agent:${issue.assigneeAgentId}`;
if (issue?.assigneeUserId) return `user:${issue.assigneeUserId}`;
return "";
}, [issue?.assigneeAgentId, issue?.assigneeUserId]);
}, [issue?.assigneeAgentId, issue?.assigneeUserId, comments, currentUserId]);
const commentsWithRunMeta = useMemo(() => {
const runMetaByCommentId = new Map<string, { runId: string; runAgentId: string | null }>();