fix: merge conflicts resolved

This commit is contained in:
Aaryan Khandelwal 2023-12-13 00:54:49 +05:30
parent 540e78deb7
commit 5d28966267
17 changed files with 57 additions and 73 deletions

View File

@ -42,6 +42,7 @@ from plane.app.permissions import (
WorkspaceUserPermission, WorkspaceUserPermission,
ProjectBasePermission, ProjectBasePermission,
ProjectMemberPermission, ProjectMemberPermission,
ProjectLitePermission,
) )
from plane.db.models import ( from plane.db.models import (
@ -602,6 +603,18 @@ class ProjectMemberViewSet(BaseViewSet):
ProjectMemberPermission, ProjectMemberPermission,
] ]
def get_permissions(self):
if self.action == "leave":
self.permission_classes = [
ProjectLitePermission,
]
else:
self.permission_classes = [
ProjectMemberPermission,
]
return super(ProjectMemberViewSet, self).get_permissions()
search_fields = [ search_fields = [
"member__display_name", "member__display_name",
"member__first_name", "member__first_name",

View File

@ -130,7 +130,7 @@ export const SelfHostedSignInForm: React.FC<Props> = (props) => {
/> />
</div> </div>
<Button type="submit" variant="primary" className="w-full" size="xl" loading={isSubmitting}> <Button type="submit" variant="primary" className="w-full" size="xl" loading={isSubmitting}>
Go to board Continue
</Button> </Button>
<p className="text-xs text-onboarding-text-200"> <p className="text-xs text-onboarding-text-200">
When you click the button above, you agree with our{" "} When you click the button above, you agree with our{" "}

View File

@ -130,7 +130,7 @@ export const SelfHostedSignInForm: React.FC<Props> = (props) => {
/> />
</div> </div>
<Button type="submit" variant="primary" className="w-full" size="xl" loading={isSubmitting}> <Button type="submit" variant="primary" className="w-full" size="xl" loading={isSubmitting}>
Go to workspace Continue
</Button> </Button>
<p className="text-xs text-onboarding-text-200"> <p className="text-xs text-onboarding-text-200">
When you click the button above, you agree with our{" "} When you click the button above, you agree with our{" "}

View File

@ -27,11 +27,21 @@ type Props = {
viewId?: string viewId?: string
) => Promise<IIssue | undefined>; ) => Promise<IIssue | undefined>;
viewId?: string; viewId?: string;
disableIssueCreation?: boolean;
}; };
export const IssueGanttSidebar: React.FC<Props> = (props) => { export const IssueGanttSidebar: React.FC<Props> = (props) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const { title, blockUpdateHandler, blocks, enableReorder, enableQuickIssueCreate, quickAddCallback, viewId } = props; const {
title,
blockUpdateHandler,
blocks,
enableReorder,
enableQuickIssueCreate,
quickAddCallback,
viewId,
disableIssueCreation,
} = props;
const router = useRouter(); const router = useRouter();
const { cycleId } = router.query; const { cycleId } = router.query;
@ -160,7 +170,7 @@ export const IssueGanttSidebar: React.FC<Props> = (props) => {
)} )}
{droppableProvided.placeholder} {droppableProvided.placeholder}
</> </>
{enableQuickIssueCreate && ( {enableQuickIssueCreate && !disableIssueCreation && (
<GanttInlineCreateIssueForm quickAddCallback={quickAddCallback} viewId={viewId} /> <GanttInlineCreateIssueForm quickAddCallback={quickAddCallback} viewId={viewId} />
)} )}
</div> </div>

View File

@ -5,7 +5,7 @@ import { useTheme } from "next-themes";
import { Button } from "@plane/ui"; import { Button } from "@plane/ui";
import { UserCog2 } from "lucide-react"; import { UserCog2 } from "lucide-react";
// images // images
import instanceSetupDone from "public/instance-setup-done.svg"; import instanceSetupDone from "public/instance-setup-done.webp";
import PlaneBlackLogo from "public/plane-logos/black-horizontal-with-blue-logo.svg"; import PlaneBlackLogo from "public/plane-logos/black-horizontal-with-blue-logo.svg";
import PlaneWhiteLogo from "public/plane-logos/white-horizontal-with-blue-logo.svg"; import PlaneWhiteLogo from "public/plane-logos/white-horizontal-with-blue-logo.svg";
import { useMobxStore } from "lib/mobx/store-provider"; import { useMobxStore } from "lib/mobx/store-provider";

View File

@ -16,6 +16,8 @@ import {
IProjectIssuesFilterStore, IProjectIssuesFilterStore,
IViewIssuesFilterStore, IViewIssuesFilterStore,
} from "store_legacy/issues"; } from "store_legacy/issues";
// constants
import { EUserWorkspaceRoles } from "constants/workspace";
type Props = { type Props = {
issuesFilterStore: issuesFilterStore:
@ -41,7 +43,14 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
const { issuesFilterStore, issues, groupedIssueIds, layout, showWeekends, quickActions, quickAddCallback, viewId } = const { issuesFilterStore, issues, groupedIssueIds, layout, showWeekends, quickActions, quickAddCallback, viewId } =
props; props;
const { calendar: calendarStore } = useMobxStore(); const {
calendar: calendarStore,
projectIssues: issueStore,
user: { currentProjectRole },
} = useMobxStore();
const { enableIssueCreation } = issueStore?.viewFlags || {};
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER;
const calendarPayload = calendarStore.calendarPayload; const calendarPayload = calendarStore.calendarPayload;
@ -71,6 +80,7 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
issues={issues} issues={issues}
groupedIssueIds={groupedIssueIds} groupedIssueIds={groupedIssueIds}
enableQuickIssueCreate enableQuickIssueCreate
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
quickActions={quickActions} quickActions={quickActions}
quickAddCallback={quickAddCallback} quickAddCallback={quickAddCallback}
viewId={viewId} viewId={viewId}
@ -85,6 +95,7 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
issues={issues} issues={issues}
groupedIssueIds={groupedIssueIds} groupedIssueIds={groupedIssueIds}
enableQuickIssueCreate enableQuickIssueCreate
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
quickActions={quickActions} quickActions={quickActions}
quickAddCallback={quickAddCallback} quickAddCallback={quickAddCallback}
viewId={viewId} viewId={viewId}

View File

@ -26,6 +26,7 @@ type Props = {
groupedIssueIds: IGroupedIssues; groupedIssueIds: IGroupedIssues;
quickActions: (issue: IIssue, customActionButton?: React.ReactElement) => React.ReactNode; quickActions: (issue: IIssue, customActionButton?: React.ReactElement) => React.ReactNode;
enableQuickIssueCreate?: boolean; enableQuickIssueCreate?: boolean;
disableIssueCreation?: boolean;
quickAddCallback?: ( quickAddCallback?: (
workspaceSlug: string, workspaceSlug: string,
projectId: string, projectId: string,
@ -43,6 +44,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
groupedIssueIds, groupedIssueIds,
quickActions, quickActions,
enableQuickIssueCreate, enableQuickIssueCreate,
disableIssueCreation,
quickAddCallback, quickAddCallback,
viewId, viewId,
} = props; } = props;
@ -86,7 +88,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
ref={provided.innerRef} ref={provided.innerRef}
> >
<CalendarIssueBlocks issues={issues} issueIdList={issueIdList} quickActions={quickActions} /> <CalendarIssueBlocks issues={issues} issueIdList={issueIdList} quickActions={quickActions} />
{enableQuickIssueCreate && ( {enableQuickIssueCreate && !disableIssueCreation && (
<div className="px-2 py-1"> <div className="px-2 py-1">
<CalendarQuickAddIssueForm <CalendarQuickAddIssueForm
formKey="target_date" formKey="target_date"

View File

@ -25,6 +25,7 @@ type Props = {
week: ICalendarWeek | undefined; week: ICalendarWeek | undefined;
quickActions: (issue: IIssue, customActionButton?: React.ReactElement) => React.ReactNode; quickActions: (issue: IIssue, customActionButton?: React.ReactElement) => React.ReactNode;
enableQuickIssueCreate?: boolean; enableQuickIssueCreate?: boolean;
disableIssueCreation?: boolean;
quickAddCallback?: ( quickAddCallback?: (
workspaceSlug: string, workspaceSlug: string,
projectId: string, projectId: string,
@ -42,6 +43,7 @@ export const CalendarWeekDays: React.FC<Props> = observer((props) => {
week, week,
quickActions, quickActions,
enableQuickIssueCreate, enableQuickIssueCreate,
disableIssueCreation,
quickAddCallback, quickAddCallback,
viewId, viewId,
} = props; } = props;
@ -69,6 +71,7 @@ export const CalendarWeekDays: React.FC<Props> = observer((props) => {
groupedIssueIds={groupedIssueIds} groupedIssueIds={groupedIssueIds}
quickActions={quickActions} quickActions={quickActions}
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
disableIssueCreation={disableIssueCreation}
quickAddCallback={quickAddCallback} quickAddCallback={quickAddCallback}
viewId={viewId} viewId={viewId}
/> />

View File

@ -51,6 +51,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
const issuesResponse = issueStore.getIssues; const issuesResponse = issueStore.getIssues;
const issueIds = (issueStore.getIssuesIds ?? []) as TUnGroupedIssues; const issueIds = (issueStore.getIssuesIds ?? []) as TUnGroupedIssues;
const { enableIssueCreation } = issueStore?.viewFlags || {};
const issues = issueIds.map((id) => issuesResponse?.[id]); const issues = issueIds.map((id) => issuesResponse?.[id]);
@ -87,6 +88,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
quickAddCallback={issueStore.quickAddIssue} quickAddCallback={issueStore.quickAddIssue}
viewId={viewId} viewId={viewId}
enableQuickIssueCreate enableQuickIssueCreate
disableIssueCreation={!enableIssueCreation || !isAllowed}
/> />
)} )}
enableBlockLeftResize={isAllowed} enableBlockLeftResize={isAllowed}

View File

@ -330,7 +330,7 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = observer((props: IBas
projects={workspaceProjects} projects={workspaceProjects}
showEmptyGroup={userDisplayFilters?.show_empty_groups || true} showEmptyGroup={userDisplayFilters?.show_empty_groups || true}
isDragStarted={isDragStarted} isDragStarted={isDragStarted}
disableIssueCreation={true} disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
enableQuickIssueCreate={enableQuickAdd} enableQuickIssueCreate={enableQuickAdd}
currentStore={currentStore} currentStore={currentStore}
quickAddCallback={issueStore?.quickAddIssue} quickAddCallback={issueStore?.quickAddIssue}

View File

@ -149,7 +149,7 @@ const GroupByKanBan: React.FC<IGroupByKanBan> = observer((props) => {
</Droppable> </Droppable>
<div className="sticky bottom-0 z-[0] w-full flex-shrink-0 bg-custom-background-90 py-1"> <div className="sticky bottom-0 z-[0] w-full flex-shrink-0 bg-custom-background-90 py-1">
{enableQuickIssueCreate && ( {enableQuickIssueCreate && !disableIssueCreation && (
<KanBanQuickAddIssueForm <KanBanQuickAddIssueForm
formKey="name" formKey="name"
groupId={getValueFromObject(_list, listKey) as string} groupId={getValueFromObject(_list, listKey) as string}

View File

@ -109,7 +109,7 @@ const GroupByList: React.FC<IGroupByList> = (props) => {
/> />
)} )}
{enableIssueQuickAdd && ( {enableIssueQuickAdd && !disableIssueCreation && (
<div className="sticky bottom-0 z-[1] w-full flex-shrink-0"> <div className="sticky bottom-0 z-[1] w-full flex-shrink-0">
<ListQuickAddIssueForm <ListQuickAddIssueForm
prePopulatedData={prePopulateQuickAddData(group_by, getValueFromObject(_list, listKey))} prePopulatedData={prePopulateQuickAddData(group_by, getValueFromObject(_list, listKey))}

View File

@ -50,7 +50,7 @@ export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
user: userStore, user: userStore,
} = useMobxStore(); } = useMobxStore();
const { enableInlineEditing, enableQuickAdd } = issueStore?.viewFlags || {}; const { enableInlineEditing, enableQuickAdd, enableIssueCreation } = issueStore?.viewFlags || {};
const { currentProjectRole } = userStore; const { currentProjectRole } = userStore;
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER; const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER;
@ -120,6 +120,7 @@ export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
quickAddCallback={issueStore.quickAddIssue} quickAddCallback={issueStore.quickAddIssue}
viewId={viewId} viewId={viewId}
enableQuickCreateIssue={enableQuickAdd} enableQuickCreateIssue={enableQuickAdd}
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
/> />
); );
}); });

View File

@ -33,6 +33,7 @@ type Props = {
viewId?: string; viewId?: string;
canEditProperties: (projectId: string | undefined) => boolean; canEditProperties: (projectId: string | undefined) => boolean;
enableQuickCreateIssue?: boolean; enableQuickCreateIssue?: boolean;
disableIssueCreation?: boolean;
}; };
export const SpreadsheetView: React.FC<Props> = observer((props) => { export const SpreadsheetView: React.FC<Props> = observer((props) => {
@ -50,6 +51,7 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
viewId, viewId,
canEditProperties, canEditProperties,
enableQuickCreateIssue, enableQuickCreateIssue,
disableIssueCreation,
} = props; } = props;
// states // states
const [expandedIssues, setExpandedIssues] = useState<string[]>([]); const [expandedIssues, setExpandedIssues] = useState<string[]>([]);
@ -147,7 +149,7 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
<div className="border-t border-custom-border-100"> <div className="border-t border-custom-border-100">
<div className="z-5 sticky bottom-0 left-0 mb-3"> <div className="z-5 sticky bottom-0 left-0 mb-3">
{enableQuickCreateIssue && ( {enableQuickCreateIssue && !disableIssueCreation && (
<SpreadsheetQuickAddIssueForm formKey="name" quickAddCallback={quickAddCallback} viewId={viewId} /> <SpreadsheetQuickAddIssueForm formKey="name" quickAddCallback={quickAddCallback} viewId={viewId} />
)} )}
</div> </div>

View File

@ -168,7 +168,7 @@ export const ProjectMemberListItem: React.FC<Props> = observer((props) => {
); );
})} })}
</CustomSelect> </CustomSelect>
{isAdmin && ( {(isAdmin || memberDetails.id === currentProjectMemberInfo?.member.id) && (
<Tooltip <Tooltip
tooltipContent={ tooltipContent={
memberDetails.id === currentProjectMemberInfo?.member.id ? "Leave project" : "Remove member" memberDetails.id === currentProjectMemberInfo?.member.id ? "Leave project" : "Remove member"

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB