mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
Merge pull request #1586 from makeplane/sync/ce-ee
Sync: Community Changes
This commit is contained in:
@@ -67,7 +67,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {
|
||||
},
|
||||
update: async (_workspaceSlug: string, _projectId: string, _issueId: string, data: Partial<TIssue>) => {
|
||||
try {
|
||||
await inboxIssue.updateIssue(data);
|
||||
await inboxIssue.updateIssue({ ...data, id: _issueId });
|
||||
captureIssueEvent({
|
||||
eventName: "Inbox issue updated",
|
||||
payload: { ...data, state: "SUCCESS", element: "Inbox" },
|
||||
|
||||
@@ -64,7 +64,7 @@ export const InboxContentRoot: FC<TInboxContentRoot> = observer((props) => {
|
||||
|
||||
const isEditable =
|
||||
allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.PROJECT) ||
|
||||
inboxIssue?.created_by === currentUser?.id;
|
||||
inboxIssue?.issue?.created_by === currentUser?.id;
|
||||
|
||||
const isGuest = projectPermissionsByWorkspaceSlugAndProjectId(workspaceSlug, projectId) === EUserPermissions.GUEST;
|
||||
const isOwner = inboxIssue?.issue.created_by === currentUser?.id;
|
||||
|
||||
@@ -59,12 +59,12 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
|
||||
});
|
||||
|
||||
const handleDescriptionFormSubmit = useCallback(
|
||||
async (formData: Partial<TIssue>) => {
|
||||
await issueOperations.update(workspaceSlug, projectId, issueId, {
|
||||
async (formData: Partial<TIssue>, _issueId: string) => {
|
||||
await issueOperations.update(workspaceSlug, projectId, _issueId, {
|
||||
description_html: formData.description_html ?? "<p></p>",
|
||||
});
|
||||
},
|
||||
[workspaceSlug, projectId, issueId, issueOperations]
|
||||
[workspaceSlug, projectId, issueOperations]
|
||||
);
|
||||
|
||||
const { getWorkspaceBySlug } = useWorkspace();
|
||||
@@ -84,14 +84,17 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
|
||||
});
|
||||
}, [initialValue, issueId, reset]);
|
||||
|
||||
// ADDING handleDescriptionFormSubmit TO DEPENDENCY ARRAY PRODUCES ADVERSE EFFECTS
|
||||
// TODO: Verify the exhaustive-deps warning
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const debouncedHandleDescriptionFormSubmit = debounce(async (data: Partial<TIssue>, _issueId: string) => {
|
||||
await handleDescriptionFormSubmit(data, _issueId);
|
||||
setIsSubmitting("submitted");
|
||||
}, 1500);
|
||||
|
||||
const debouncedFormSave = useCallback(
|
||||
debounce(async () => {
|
||||
handleSubmit(handleDescriptionFormSubmit)().finally(() => setIsSubmitting("submitted"));
|
||||
}, 1500),
|
||||
[handleSubmit, issueId]
|
||||
(_issueId: string) =>
|
||||
handleSubmit((data) => {
|
||||
debouncedHandleDescriptionFormSubmit(data, _issueId);
|
||||
})(),
|
||||
[debouncedHandleDescriptionFormSubmit, handleSubmit]
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -113,7 +116,7 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
|
||||
onChange={(_description: object, description_html: string) => {
|
||||
setIsSubmitting("submitting");
|
||||
onChange(description_html);
|
||||
debouncedFormSave();
|
||||
debouncedFormSave(issueId);
|
||||
}}
|
||||
placeholder={
|
||||
placeholder ? placeholder : (isFocused, value) => getDescriptionPlaceholder(isFocused, value)
|
||||
|
||||
@@ -12,10 +12,11 @@ type Props = {
|
||||
projectId: string;
|
||||
issueId: string;
|
||||
disabled: boolean;
|
||||
renderWidgetModals?: boolean;
|
||||
};
|
||||
|
||||
export const IssueDetailWidgets: FC<Props> = (props) => {
|
||||
const { workspaceSlug, projectId, issueId, disabled } = props;
|
||||
const { workspaceSlug, projectId, issueId, disabled, renderWidgetModals = true } = props;
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col gap-5">
|
||||
@@ -32,7 +33,9 @@ export const IssueDetailWidgets: FC<Props> = (props) => {
|
||||
disabled={disabled}
|
||||
/>
|
||||
</div>
|
||||
<IssueDetailWidgetModals workspaceSlug={workspaceSlug} projectId={projectId} issueId={issueId} />
|
||||
{renderWidgetModals && (
|
||||
<IssueDetailWidgetModals workspaceSlug={workspaceSlug} projectId={projectId} issueId={issueId} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -40,6 +40,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
||||
const { data: currentUser } = useUser();
|
||||
const {
|
||||
issue: { getIssueById },
|
||||
peekIssue,
|
||||
} = useIssueDetail();
|
||||
const { setShowAlert } = useReloadConfirmations(isSubmitting === "submitting");
|
||||
|
||||
@@ -53,6 +54,8 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
||||
const issue = issueId ? getIssueById(issueId) : undefined;
|
||||
if (!issue || !issue.project_id) return <></>;
|
||||
|
||||
const isPeekModeActive = Boolean(peekIssue);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="rounded-lg space-y-4">
|
||||
@@ -110,6 +113,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
||||
projectId={projectId}
|
||||
issueId={issueId}
|
||||
disabled={!isEditable || isArchived}
|
||||
renderWidgetModals={!isPeekModeActive}
|
||||
/>
|
||||
|
||||
{windowSize[0] < 768 && (
|
||||
|
||||
@@ -151,12 +151,12 @@ export class InboxIssueStore implements IInboxIssueStore {
|
||||
updateIssue = async (issue: Partial<TIssue>) => {
|
||||
const inboxIssue = clone(this.issue);
|
||||
try {
|
||||
if (!this.issue.id) return;
|
||||
if (!issue.id) return;
|
||||
Object.keys(issue).forEach((key) => {
|
||||
const issueKey = key as keyof TIssue;
|
||||
set(this.issue, issueKey, issue[issueKey]);
|
||||
});
|
||||
await this.inboxIssueService.updateIssue(this.workspaceSlug, this.projectId, this.issue.id, issue);
|
||||
await this.inboxIssueService.updateIssue(this.workspaceSlug, this.projectId, issue.id, issue);
|
||||
// fetching activity
|
||||
this.fetchIssueActivity();
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user