forked from github/plane
fix: issue parent activity (#1629)
This commit is contained in:
parent
a7b5ad55ab
commit
464c13fcd0
@ -2,7 +2,7 @@ import { useRouter } from "next/router";
|
|||||||
|
|
||||||
// components
|
// components
|
||||||
import { CycleIssuesGanttChartView } from "components/cycles";
|
import { CycleIssuesGanttChartView } from "components/cycles";
|
||||||
import { IssueGanttChartView } from "components/issues/gantt-chart";
|
import { IssueGanttChartView } from "components/issues";
|
||||||
import { ModuleIssuesGanttChartView } from "components/modules";
|
import { ModuleIssuesGanttChartView } from "components/modules";
|
||||||
import { ViewIssuesGanttChartView } from "components/views";
|
import { ViewIssuesGanttChartView } from "components/views";
|
||||||
|
|
||||||
|
@ -54,8 +54,22 @@ const activityDetails: {
|
|||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
message: (activity) => {
|
message: (activity) => {
|
||||||
if (activity.verb === "created") return "uploaded a new attachment.";
|
if (activity.verb === "created")
|
||||||
else return "removed the attachment.";
|
return (
|
||||||
|
<>
|
||||||
|
uploaded a new{" "}
|
||||||
|
<a
|
||||||
|
href={`${activity.new_value}`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
||||||
|
>
|
||||||
|
attachment
|
||||||
|
<Icon iconName="launch" className="!text-xs" />
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
else return "removed an attachment.";
|
||||||
},
|
},
|
||||||
icon: <Icon iconName="attach_file" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="attach_file" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
@ -187,28 +201,15 @@ const activityDetails: {
|
|||||||
href={`${activity.new_value}`}
|
href={`${activity.new_value}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="text-custom-text-100"
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
||||||
>
|
>
|
||||||
link
|
link
|
||||||
|
<Icon iconName="launch" className="!text-xs" />
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
to the issue.
|
to the issue.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
else
|
else return "removed a link.";
|
||||||
return (
|
|
||||||
<>
|
|
||||||
removed this{" "}
|
|
||||||
<a
|
|
||||||
href={`${activity.old_value}`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="text-custom-text-100"
|
|
||||||
>
|
|
||||||
link
|
|
||||||
</a>{" "}
|
|
||||||
from the issue.
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
icon: <Icon iconName="link" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="link" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
@ -244,18 +245,18 @@ const activityDetails: {
|
|||||||
},
|
},
|
||||||
parent: {
|
parent: {
|
||||||
message: (activity) => {
|
message: (activity) => {
|
||||||
if (!activity.old_value)
|
if (!activity.new_value)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
set the parent to{" "}
|
removed the parent{" "}
|
||||||
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
removed the parent{" "}
|
set the parent to{" "}
|
||||||
<span className="font-medium text-custom-text-100">{activity.old_value}</span>.
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -373,7 +374,7 @@ export const IssueActivitySection: React.FC<Props> = ({ issueId, user }) => {
|
|||||||
{issueActivities.map((activityItem, index) => {
|
{issueActivities.map((activityItem, index) => {
|
||||||
// determines what type of action is performed
|
// determines what type of action is performed
|
||||||
const message = activityItem.field
|
const message = activityItem.field
|
||||||
? activityDetails[activityItem.field as keyof typeof activityDetails].message(
|
? activityDetails[activityItem.field as keyof typeof activityDetails]?.message(
|
||||||
activityItem
|
activityItem
|
||||||
)
|
)
|
||||||
: "created the issue.";
|
: "created the issue.";
|
||||||
|
@ -6,14 +6,14 @@ import { mutate } from "swr";
|
|||||||
|
|
||||||
// react-dropzone
|
// react-dropzone
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
// toast
|
|
||||||
import useToast from "hooks/use-toast";
|
|
||||||
// fetch key
|
|
||||||
import { ISSUE_ATTACHMENTS } from "constants/fetch-keys";
|
|
||||||
// services
|
// services
|
||||||
import issuesService from "services/issues.service";
|
import issuesService from "services/issues.service";
|
||||||
// type
|
// hooks
|
||||||
|
import useToast from "hooks/use-toast";
|
||||||
|
// types
|
||||||
import { IIssueAttachment } from "types";
|
import { IIssueAttachment } from "types";
|
||||||
|
// fetch-keys
|
||||||
|
import { ISSUE_ATTACHMENTS, PROJECT_ISSUES_ACTIVITY } from "constants/fetch-keys";
|
||||||
|
|
||||||
const maxFileSize = 5 * 1024 * 1024; // 5 MB
|
const maxFileSize = 5 * 1024 * 1024; // 5 MB
|
||||||
|
|
||||||
@ -56,6 +56,7 @@ export const IssueAttachmentUpload: React.FC<Props> = ({ disabled = false }) =>
|
|||||||
(prevData) => [res, ...(prevData ?? [])],
|
(prevData) => [res, ...(prevData ?? [])],
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Success!",
|
title: "Success!",
|
@ -81,12 +81,12 @@ export const IssueAttachments = () => {
|
|||||||
} uploaded on ${renderLongDateFormat(file.updated_at)}`}
|
} uploaded on ${renderLongDateFormat(file.updated_at)}`}
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
<ExclamationIcon className="h-3 w-3 fill-current text-custom-text-100" />
|
<ExclamationIcon className="h-3 w-3 fill-current" />
|
||||||
</span>
|
</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-3 text-xs text-gray-500">
|
<div className="flex items-center gap-3 text-xs text-custom-text-200">
|
||||||
<span>{getFileExtension(file.asset).toUpperCase()}</span>
|
<span>{getFileExtension(file.asset).toUpperCase()}</span>
|
||||||
<span>{convertBytesToSize(file.attributes.size)}</span>
|
<span>{convertBytesToSize(file.attributes.size)}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -101,7 +101,7 @@ export const IssueAttachments = () => {
|
|||||||
setAttachmentDeleteModal(true);
|
setAttachmentDeleteModal(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<XMarkIcon className="h-4 w-4 text-gray-500 hover:text-gray-800" />
|
<XMarkIcon className="h-4 w-4 text-custom-text-200 hover:text-custom-text-100" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
@ -19,7 +19,7 @@ import { getFileName } from "helpers/attachment.helper";
|
|||||||
// types
|
// types
|
||||||
import type { IIssueAttachment } from "types";
|
import type { IIssueAttachment } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { ISSUE_ATTACHMENTS } from "constants/fetch-keys";
|
import { ISSUE_ATTACHMENTS, PROJECT_ISSUES_ACTIVITY } from "constants/fetch-keys";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -53,6 +53,7 @@ export const DeleteAttachmentModal: React.FC<Props> = ({ isOpen, setIsOpen, data
|
|||||||
issueId as string,
|
issueId as string,
|
||||||
assetId as string
|
assetId as string
|
||||||
)
|
)
|
||||||
|
.then(() => mutate(PROJECT_ISSUES_ACTIVITY(issueId as string)))
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
3
apps/app/components/issues/attachment/index.ts
Normal file
3
apps/app/components/issues/attachment/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export * from "./attachment-upload";
|
||||||
|
export * from "./attachments";
|
||||||
|
export * from "./delete-attachment-modal";
|
@ -1,3 +1,4 @@
|
|||||||
|
export * from "./attachment";
|
||||||
export * from "./comment";
|
export * from "./comment";
|
||||||
export * from "./sidebar-select";
|
export * from "./sidebar-select";
|
||||||
export * from "./view-select";
|
export * from "./view-select";
|
||||||
@ -5,12 +6,10 @@ export * from "./activity";
|
|||||||
export * from "./delete-issue-modal";
|
export * from "./delete-issue-modal";
|
||||||
export * from "./description-form";
|
export * from "./description-form";
|
||||||
export * from "./form";
|
export * from "./form";
|
||||||
|
export * from "./gantt-chart";
|
||||||
export * from "./main-content";
|
export * from "./main-content";
|
||||||
export * from "./modal";
|
export * from "./modal";
|
||||||
export * from "./my-issues-list-item";
|
export * from "./my-issues-list-item";
|
||||||
export * from "./parent-issues-list-modal";
|
export * from "./parent-issues-list-modal";
|
||||||
export * from "./sidebar";
|
export * from "./sidebar";
|
||||||
export * from "./sub-issues-list";
|
export * from "./sub-issues-list";
|
||||||
export * from "./attachment-upload";
|
|
||||||
export * from "./attachments";
|
|
||||||
export * from "./delete-attachment-modal";
|
|
||||||
|
@ -76,6 +76,9 @@ const IssueDetailsPage: NextPage = () => {
|
|||||||
...formData,
|
...formData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
delete payload.blocker_issues;
|
||||||
|
delete payload.blocked_issues;
|
||||||
|
|
||||||
await issuesService
|
await issuesService
|
||||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
|
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user