mirror of
https://github.com/makeplane/plane.git
synced 2025-12-25 08:09:33 +01:00
fix: added workspaceslug in renderChildren of project settings (#5951)
* fix: added workspaceslug in renderChildren of project settings * fix: updated apis * fix: types * fix: added editor * fix: handled avatar for intake
This commit is contained in:
@@ -13,7 +13,8 @@ export type TProperties = {
|
||||
renderChildren?: (
|
||||
currentProjectDetails: IProject,
|
||||
isAdmin: boolean,
|
||||
handleSubmit: (featureKey: string, featureProperty: string) => Promise<void>
|
||||
handleSubmit: (featureKey: string, featureProperty: string) => Promise<void>,
|
||||
workspaceSlug: string
|
||||
) => ReactNode;
|
||||
};
|
||||
export type TFeatureList = {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { FC, MouseEvent } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import Link from "next/link";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { Tooltip, PriorityIcon, Row } from "@plane/ui";
|
||||
import { Tooltip, PriorityIcon, Row, Avatar } from "@plane/ui";
|
||||
// components
|
||||
import { ButtonAvatars } from "@/components/dropdowns/member/avatar";
|
||||
import { InboxIssueStatus } from "@/components/inbox";
|
||||
@@ -12,6 +12,7 @@ import { InboxIssueStatus } from "@/components/inbox";
|
||||
import { cn } from "@/helpers/common.helper";
|
||||
import { renderFormattedDate } from "@/helpers/date-time.helper";
|
||||
// hooks
|
||||
import { getFileURL } from "@/helpers/file.helper";
|
||||
import { useLabel, useMember, useProjectInbox } from "@/hooks/store";
|
||||
import { usePlatformOS } from "@/hooks/use-platform-os";
|
||||
|
||||
@@ -116,7 +117,11 @@ export const InboxIssueListItem: FC<InboxIssueListItemProps> = observer((props)
|
||||
)}
|
||||
</div>
|
||||
{/* created by */}
|
||||
{createdByDetails && <ButtonAvatars showTooltip={false} userIds={createdByDetails?.id} />}
|
||||
{createdByDetails && createdByDetails.email?.includes("intake@plane.so") ? (
|
||||
<Avatar src={getFileURL("")} name={"Plane"} size="md" showTooltip />
|
||||
) : createdByDetails ? (
|
||||
<ButtonAvatars showTooltip={false} userIds={createdByDetails?.id} />
|
||||
) : null}
|
||||
</div>
|
||||
</Row>
|
||||
</Link>
|
||||
|
||||
@@ -102,7 +102,7 @@ export const ProjectFeaturesList: FC<Props> = observer((props) => {
|
||||
<div className="pl-14">
|
||||
{currentProjectDetails?.[featureItem.property as keyof IProject] &&
|
||||
featureItem.renderChildren &&
|
||||
featureItem.renderChildren(currentProjectDetails, isAdmin, handleSubmit)}
|
||||
featureItem.renderChildren(currentProjectDetails, isAdmin, handleSubmit, workspaceSlug)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -77,17 +77,15 @@ export class InboxIssueService extends APIService {
|
||||
}
|
||||
|
||||
async retrievePublishForm(workspaceSlug: string, projectId: string): Promise<TInboxForm> {
|
||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/publish-intake/`)
|
||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/intake-settings/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async updatePublishForm(workspaceSlug: string, projectId: string, is_disabled: boolean): Promise<TInboxIssue> {
|
||||
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/publish-intake/`, {
|
||||
is_disabled,
|
||||
})
|
||||
async updatePublishForm(workspaceSlug: string, projectId: string, data: Partial<TInboxForm>): Promise<TInboxForm> {
|
||||
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/intake-settings/`, data)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
|
||||
@@ -71,7 +71,7 @@ export interface IProjectInboxStore {
|
||||
fetchInboxPaginationIssues: (workspaceSlug: string, projectId: string) => Promise<void>;
|
||||
fetchInboxIssueById: (workspaceSlug: string, projectId: string, inboxIssueId: string) => Promise<TInboxIssue>;
|
||||
fetchIntakeForms: (workspaceSlug: string, projectId: string) => Promise<void>;
|
||||
toggleIntakeForms: (workspaceSlug: string, projectId: string, isDisabled: boolean) => Promise<void>;
|
||||
toggleIntakeForms: (workspaceSlug: string, projectId: string, data: Partial<TInboxForm>) => Promise<void>;
|
||||
regenerateIntakeForms: (workspaceSlug: string, projectId: string) => Promise<void>;
|
||||
createInboxIssue: (
|
||||
workspaceSlug: string,
|
||||
@@ -329,20 +329,23 @@ export class ProjectInboxStore implements IProjectInboxStore {
|
||||
}
|
||||
};
|
||||
|
||||
toggleIntakeForms = async (workspaceSlug: string, projectId: string, isDisabled: boolean) => {
|
||||
toggleIntakeForms = async (workspaceSlug: string, projectId: string, data: Partial<TInboxForm>) => {
|
||||
const initialData = this.intakeForms[projectId];
|
||||
try {
|
||||
runInAction(() => {
|
||||
set(this.intakeForms, projectId, { ...this.intakeForms[projectId], is_disabled: isDisabled });
|
||||
set(this.intakeForms, projectId, { ...this.intakeForms[projectId], ...data });
|
||||
});
|
||||
const result = await this.inboxIssueService.updatePublishForm(workspaceSlug, projectId, data);
|
||||
runInAction(() => {
|
||||
set(this.intakeForms, projectId, { ...this.intakeForms[projectId], anchor: result?.anchor });
|
||||
});
|
||||
await this.inboxIssueService.updatePublishForm(workspaceSlug, projectId, isDisabled);
|
||||
} catch {
|
||||
console.error("Error fetching the publish forms");
|
||||
runInAction(() => {
|
||||
set(this.intakeForms, projectId, { ...this.intakeForms[projectId], is_disabled: !isDisabled });
|
||||
set(this.intakeForms, projectId, initialData);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
regenerateIntakeForms = async (workspaceSlug: string, projectId: string) => {
|
||||
try {
|
||||
const form = await this.inboxIssueService.regeneratePublishForm(workspaceSlug, projectId);
|
||||
|
||||
Reference in New Issue
Block a user