chore: peek overview authorization (#2632)

* chore: peek overview authorization

* chore: comment access specifier validation
This commit is contained in:
Aaryan Khandelwal 2023-11-03 19:13:10 +05:30 committed by GitHub
parent d48f13416f
commit 992cf79031
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 270 additions and 195 deletions

View file

@ -6,7 +6,6 @@ import { IssueView } from "./view";
import { useMobxStore } from "lib/mobx/store-provider";
// types
import { IIssue } from "types";
import { RootStore } from "store/root";
interface IIssuePeekOverview {
workspaceSlug: string;
@ -19,7 +18,7 @@ interface IIssuePeekOverview {
export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
const { workspaceSlug, projectId, issueId, handleIssue, children } = props;
const { issueDetail: issueDetailStore }: RootStore = useMobxStore();
const { issueDetail: issueDetailStore, project: projectStore, user: userStore } = useMobxStore();
const issueUpdate = (_data: Partial<IIssue>) => {
handleIssue(_data);
@ -52,6 +51,8 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
const handleDeleteIssue = () => issueDetailStore.deleteIssue(workspaceSlug, projectId, issueId);
const userRole = userStore.currentProjectRole ?? 5;
return (
<IssueView
workspaceSlug={workspaceSlug}
@ -68,6 +69,8 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
issueSubscriptionCreate={issueSubscriptionCreate}
issueSubscriptionRemove={issueSubscriptionRemove}
handleDeleteIssue={handleDeleteIssue}
disableUserActions={[5, 10].includes(userRole)}
showCommentAccessSpecifier={projectStore.currentProjectDetails?.is_deployed}
>
{children}
</IssueView>