fix(subscribers): pass user_type to subscribe/unsubscribe API for correct agent handling
Root cause: backend hardcoded UserType="member" in subscribe/unsubscribe handlers, so unsubscribing an agent actually tried to delete a member record (no-op), and the WS event broadcast wrong user_type causing other subscribers' UI to break. - Backend: accept optional user_type in subscribe/unsubscribe request body - Frontend: pass userType through API client to backend - Fixes: clicking agent checkbox no longer affects member subscriptions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
df6f6584c3
commit
b8fa71462a
3 changed files with 29 additions and 13 deletions
|
|
@ -275,10 +275,10 @@ export function IssueDetail({ issueId, onDelete }: IssueDetailProps) {
|
|||
if (!issue) return;
|
||||
try {
|
||||
if (currentlySubscribed) {
|
||||
await api.unsubscribeFromIssue(id, userId);
|
||||
await api.unsubscribeFromIssue(id, userId, userType);
|
||||
setSubscribers((prev) => prev.filter((s) => !(s.user_id === userId && s.user_type === userType)));
|
||||
} else {
|
||||
await api.subscribeToIssue(id, userId);
|
||||
await api.subscribeToIssue(id, userId, userType);
|
||||
setSubscribers((prev) => [
|
||||
...prev,
|
||||
{ issue_id: id, user_type: userType, user_id: userId, reason: "manual" as const, created_at: new Date().toISOString() },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue