Skip to content

Commit

Permalink
Merge pull request #3097 from makeplane/develop
Browse files Browse the repository at this point in the history
promote: develop to preview
  • Loading branch information
sriramveeraghanta authored Dec 12, 2023
2 parents 449ac06 + 48fe6f9 commit 4fdac43
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 12 deletions.
13 changes: 13 additions & 0 deletions apiserver/plane/app/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
WorkspaceUserPermission,
ProjectBasePermission,
ProjectMemberPermission,
ProjectLitePermission,
)

from plane.db.models import (
Expand Down Expand Up @@ -602,6 +603,18 @@ class ProjectMemberViewSet(BaseViewSet):
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 = [
"member__display_name",
"member__first_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const SelfHostedSignInForm: React.FC<Props> = (props) => {
/>
</div>
<Button type="submit" variant="primary" className="w-full" size="xl" loading={isSubmitting}>
Go to board
Continue
</Button>
<p className="text-xs text-onboarding-text-200">
When you click the button above, you agree with our{" "}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const SelfHostedSignInForm: React.FC<Props> = (props) => {
/>
</div>
<Button type="submit" variant="primary" className="w-full" size="xl" loading={isSubmitting}>
Go to workspace
Continue
</Button>
<p className="text-xs text-onboarding-text-200">
When you click the button above, you agree with our{" "}
Expand Down
14 changes: 12 additions & 2 deletions web/components/gantt-chart/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,21 @@ type Props = {
viewId?: string
) => Promise<IIssue | undefined>;
viewId?: string;
disableIssueCreation?: boolean;
};

export const IssueGanttSidebar: React.FC<Props> = (props) => {
// 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 { cycleId } = router.query;
Expand Down Expand Up @@ -160,7 +170,7 @@ export const IssueGanttSidebar: React.FC<Props> = (props) => {
)}
{droppableProvided.placeholder}
</>
{enableQuickIssueCreate && (
{enableQuickIssueCreate && !disableIssueCreation && (
<GanttInlineCreateIssueForm quickAddCallback={quickAddCallback} viewId={viewId} />
)}
</div>
Expand Down
13 changes: 12 additions & 1 deletion web/components/issues/issue-layouts/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
IProjectIssuesFilterStore,
IViewIssuesFilterStore,
} from "store/issues";
// constants
import { EUserWorkspaceRoles } from "constants/workspace";

type Props = {
issuesFilterStore:
Expand All @@ -41,7 +43,14 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
const { issuesFilterStore, issues, groupedIssueIds, layout, showWeekends, quickActions, quickAddCallback, viewId } =
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;

Expand Down Expand Up @@ -71,6 +80,7 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
issues={issues}
groupedIssueIds={groupedIssueIds}
enableQuickIssueCreate
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
quickActions={quickActions}
quickAddCallback={quickAddCallback}
viewId={viewId}
Expand All @@ -85,6 +95,7 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
issues={issues}
groupedIssueIds={groupedIssueIds}
enableQuickIssueCreate
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
quickActions={quickActions}
quickAddCallback={quickAddCallback}
viewId={viewId}
Expand Down
4 changes: 3 additions & 1 deletion web/components/issues/issue-layouts/calendar/day-tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Props = {
groupedIssueIds: IGroupedIssues;
quickActions: (issue: IIssue, customActionButton?: React.ReactElement) => React.ReactNode;
enableQuickIssueCreate?: boolean;
disableIssueCreation?: boolean;
quickAddCallback?: (
workspaceSlug: string,
projectId: string,
Expand All @@ -43,6 +44,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
groupedIssueIds,
quickActions,
enableQuickIssueCreate,
disableIssueCreation,
quickAddCallback,
viewId,
} = props;
Expand Down Expand Up @@ -86,7 +88,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
ref={provided.innerRef}
>
<CalendarIssueBlocks issues={issues} issueIdList={issueIdList} quickActions={quickActions} />
{enableQuickIssueCreate && (
{enableQuickIssueCreate && !disableIssueCreation && (
<div className="px-2 py-1">
<CalendarQuickAddIssueForm
formKey="target_date"
Expand Down
3 changes: 3 additions & 0 deletions web/components/issues/issue-layouts/calendar/week-days.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Props = {
week: ICalendarWeek | undefined;
quickActions: (issue: IIssue, customActionButton?: React.ReactElement) => React.ReactNode;
enableQuickIssueCreate?: boolean;
disableIssueCreation?: boolean;
quickAddCallback?: (
workspaceSlug: string,
projectId: string,
Expand All @@ -42,6 +43,7 @@ export const CalendarWeekDays: React.FC<Props> = observer((props) => {
week,
quickActions,
enableQuickIssueCreate,
disableIssueCreation,
quickAddCallback,
viewId,
} = props;
Expand Down Expand Up @@ -69,6 +71,7 @@ export const CalendarWeekDays: React.FC<Props> = observer((props) => {
groupedIssueIds={groupedIssueIds}
quickActions={quickActions}
enableQuickIssueCreate={enableQuickIssueCreate}
disableIssueCreation={disableIssueCreation}
quickAddCallback={quickAddCallback}
viewId={viewId}
/>
Expand Down
2 changes: 2 additions & 0 deletions web/components/issues/issue-layouts/gantt/base-gantt-root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan

const issuesResponse = issueStore.getIssues;
const issueIds = (issueStore.getIssuesIds ?? []) as TUnGroupedIssues;
const { enableIssueCreation } = issueStore?.viewFlags || {};

const issues = issueIds.map((id) => issuesResponse?.[id]);

Expand Down Expand Up @@ -87,6 +88,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
quickAddCallback={issueStore.quickAddIssue}
viewId={viewId}
enableQuickIssueCreate
disableIssueCreation={!enableIssueCreation || !isAllowed}
/>
)}
enableBlockLeftResize={isAllowed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = observer((props: IBas
projects={workspaceProjects}
showEmptyGroup={userDisplayFilters?.show_empty_groups || true}
isDragStarted={isDragStarted}
disableIssueCreation={true}
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
enableQuickIssueCreate={enableQuickAdd}
currentStore={currentStore}
quickAddCallback={issueStore?.quickAddIssue}
Expand Down
2 changes: 1 addition & 1 deletion web/components/issues/issue-layouts/kanban/default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const GroupByKanBan: React.FC<IGroupByKanBan> = observer((props) => {
</Droppable>

<div className="sticky bottom-0 z-[0] w-full flex-shrink-0 bg-custom-background-90 py-1">
{enableQuickIssueCreate && (
{enableQuickIssueCreate && !disableIssueCreation && (
<KanBanQuickAddIssueForm
formKey="name"
groupId={getValueFromObject(_list, listKey) as string}
Expand Down
2 changes: 1 addition & 1 deletion web/components/issues/issue-layouts/list/default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<ListQuickAddIssueForm
prePopulatedData={prePopulateQuickAddData(group_by, getValueFromObject(_list, listKey))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
user: userStore,
} = useMobxStore();

const { enableInlineEditing, enableQuickAdd } = issueStore?.viewFlags || {};
const { enableInlineEditing, enableQuickAdd, enableIssueCreation } = issueStore?.viewFlags || {};

const { currentProjectRole } = userStore;
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER;
Expand Down Expand Up @@ -120,6 +120,7 @@ export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
quickAddCallback={issueStore.quickAddIssue}
viewId={viewId}
enableQuickCreateIssue={enableQuickAdd}
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
/>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Props = {
viewId?: string;
canEditProperties: (projectId: string | undefined) => boolean;
enableQuickCreateIssue?: boolean;
disableIssueCreation?: boolean;
};

export const SpreadsheetView: React.FC<Props> = observer((props) => {
Expand All @@ -50,6 +51,7 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
viewId,
canEditProperties,
enableQuickCreateIssue,
disableIssueCreation,
} = props;
// states
const [expandedIssues, setExpandedIssues] = useState<string[]>([]);
Expand Down Expand Up @@ -147,7 +149,7 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {

<div className="border-t border-custom-border-100">
<div className="z-5 sticky bottom-0 left-0 mb-3">
{enableQuickCreateIssue && (
{enableQuickCreateIssue && !disableIssueCreation && (
<SpreadsheetQuickAddIssueForm formKey="name" quickAddCallback={quickAddCallback} viewId={viewId} />
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/components/project/member-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const ProjectMemberListItem: React.FC<Props> = observer((props) => {
);
})}
</CustomSelect>
{isAdmin && (
{(isAdmin || memberDetails.id === currentProjectMemberInfo?.member.id) && (
<Tooltip
tooltipContent={
memberDetails.id === currentProjectMemberInfo?.member.id ? "Leave project" : "Remove member"
Expand Down

0 comments on commit 4fdac43

Please sign in to comment.