[WEB-2121] fix: project issue creation (#5266)

* fix: project issue creation

* fix: refactored
This commit is contained in:
Akshita Goyal 2024-07-31 14:13:09 +05:30 committed by GitHub
parent 569b592711
commit dd3df20319
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,13 @@
import { action, makeObservable, runInAction, } from "mobx";
import { action, makeObservable, runInAction } from "mobx";
// types
import { TIssue, TLoader, ViewFlags, IssuePaginationOptions, TIssuesResponse, TBulkOperationsPayload } from "@plane/types";
import {
TIssue,
TLoader,
ViewFlags,
IssuePaginationOptions,
TIssuesResponse,
TBulkOperationsPayload,
} from "@plane/types";
// helpers
// base class
import { BaseIssuesStore, IBaseIssuesStore } from "../helpers/base-issues.store";
@ -44,6 +51,7 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
enableIssueCreation: true,
enableInlineEditing: true,
};
router;
// filter store
issueFilterStore: IProjectIssuesFilter;
@ -59,6 +67,7 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
});
// filter store
this.issueFilterStore = issueFilterStore;
this.router = _rootStore.rootStore.router;
}
/**
@ -165,6 +174,18 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
return await this.fetchIssues(workspaceSlug, projectId, loadType, this.paginationOptions, true);
};
/**
* Override inherited create issue, to update list only if user is on current project
* @param workspaceSlug
* @param projectId
* @param data
* @returns
*/
override createIssue = async (workspaceSlug: string, projectId: string, data: Partial<TIssue>) => {
const response = await super.createIssue(workspaceSlug, projectId, data, "", projectId === this.router.projectId);
return response;
};
// Using aliased names as they cannot be overridden in other stores
archiveBulkIssues = this.bulkArchiveIssues;
quickAddIssue = this.issueQuickAdd;