[WEB-2190] fix: unauthorised delete and redirections (#5342)

* fix: cycle unauthorised delete action redirection

* fix: intake unauthorised delete action redirection
This commit is contained in:
Anmol Singh Bhatia 2024-08-09 19:14:38 +05:30 committed by GitHub
parent 679b0b6465
commit 6d0cf1b4e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 19 deletions

View file

@ -484,25 +484,23 @@ export class ProjectInboxStore implements IProjectInboxStore {
const currentIssue = this.inboxIssues?.[inboxIssueId];
try {
if (!currentIssue) return;
runInAction(() => {
set(
this,
["inboxIssuePaginationInfo", "total_results"],
(this.inboxIssuePaginationInfo?.total_results || 0) - 1
);
set(this, "inboxIssues", omit(this.inboxIssues, inboxIssueId));
set(
this,
["inboxIssueIds"],
this.inboxIssueIds.filter((id) => id !== inboxIssueId)
);
await this.inboxIssueService.destroy(workspaceSlug, projectId, inboxIssueId).then(() => {
runInAction(() => {
set(
this,
["inboxIssuePaginationInfo", "total_results"],
(this.inboxIssuePaginationInfo?.total_results || 0) - 1
);
set(this, "inboxIssues", omit(this.inboxIssues, inboxIssueId));
set(
this,
["inboxIssueIds"],
this.inboxIssueIds.filter((id) => id !== inboxIssueId)
);
});
});
await this.inboxIssueService.destroy(workspaceSlug, projectId, inboxIssueId);
} catch (error) {
console.error("Error removing the intake issue");
set(this.inboxIssues, [inboxIssueId], currentIssue);
set(this, ["inboxIssuePaginationInfo", "total_results"], (this.inboxIssuePaginationInfo?.total_results || 0) + 1);
set(this, ["inboxIssueIds"], [...this.inboxIssueIds, inboxIssueId]);
throw error;
}
};