mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: edit issue comment mutation (#2109)
This commit is contained in:
parent
1655d0cb1c
commit
85f797058d
@ -154,29 +154,32 @@ class IssueDetailStore implements IssueDetailStore {
|
|||||||
data: any
|
data: any
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
const issueCommentUpdateResponse = await this.issueService.updateIssueComment(
|
runInAction(() => {
|
||||||
workspaceSlug,
|
this.details = {
|
||||||
projectId,
|
...this.details,
|
||||||
issueId,
|
[issueId]: {
|
||||||
commentId,
|
...this.details[issueId],
|
||||||
data
|
comments: this.details[issueId].comments.map((c) => ({
|
||||||
);
|
...c,
|
||||||
|
...(c.id === commentId ? data : {}),
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
if (issueCommentUpdateResponse) {
|
await this.issueService.updateIssueComment(workspaceSlug, projectId, issueId, commentId, data);
|
||||||
const remainingComments = this.details[issueId].comments.filter((com) => com.id != commentId);
|
|
||||||
runInAction(() => {
|
|
||||||
this.details = {
|
|
||||||
...this.details,
|
|
||||||
[issueId]: {
|
|
||||||
...this.details[issueId],
|
|
||||||
comments: [...remainingComments, issueCommentUpdateResponse],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return issueCommentUpdateResponse;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Failed to add issue comment");
|
const issueComments = await this.issueService.getIssueComments(workspaceSlug, projectId, issueId);
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
|
this.details = {
|
||||||
|
...this.details,
|
||||||
|
[issueId]: {
|
||||||
|
...this.details[issueId],
|
||||||
|
comments: issueComments,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user