feat: issue activity logs (#782)

* feat: attachment, link and estimate activity log added in issue detail page

* feat: attachment, link and estimate activity log added in profile activity section
This commit is contained in:
Anmol Singh Bhatia 2023-04-11 18:14:36 +05:30 committed by GitHub
parent dfa3a7b78d
commit 61b9e7a161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 2 deletions

View File

@ -8,6 +8,9 @@ import {
ChartBarIcon, ChartBarIcon,
ChatBubbleBottomCenterTextIcon, ChatBubbleBottomCenterTextIcon,
ChatBubbleLeftEllipsisIcon, ChatBubbleLeftEllipsisIcon,
LinkIcon,
PaperClipIcon,
PlayIcon,
RectangleGroupIcon, RectangleGroupIcon,
Squares2X2Icon, Squares2X2Icon,
TrashIcon, TrashIcon,
@ -82,6 +85,18 @@ const activityDetails: {
message: "deleted the issue.", message: "deleted the issue.",
icon: <TrashIcon className="h-3 w-3 text-gray-500" aria-hidden="true" />, icon: <TrashIcon className="h-3 w-3 text-gray-500" aria-hidden="true" />,
}, },
estimate: {
message: "updated the estimate",
icon: <PlayIcon className="h-3 w-3 text-gray-500 -rotate-90" aria-hidden="true" />,
},
link: {
message: "updated the link",
icon: <LinkIcon className="h-3 w-3 text-gray-500" aria-hidden="true" />,
},
attachment: {
message: "updated the attachment",
icon: <PaperClipIcon className="h-3 w-3 text-gray-500 " aria-hidden="true" />,
},
}; };
export const Feeds: React.FC<any> = ({ activities }) => ( export const Feeds: React.FC<any> = ({ activities }) => (
@ -117,13 +132,22 @@ export const Feeds: React.FC<any> = ({ activities }) => (
: "removed the priority"; : "removed the priority";
} else if (activity.field === "description") { } else if (activity.field === "description") {
action = "updated the"; action = "updated the";
} else if (activity.field === "attachment") {
action = `${activity.verb} the`;
} else if (activity.field === "link") {
action = `${activity.verb} the`;
} else if (activity.field === "estimate") {
action = "updated the";
} }
// for values that are after the action clause // for values that are after the action clause
let value: any = activity.new_value ? activity.new_value : activity.old_value; let value: any = activity.new_value ? activity.new_value : activity.old_value;
if ( if (
activity.verb === "created" && activity.verb === "created" &&
activity.field !== "cycles" && activity.field !== "cycles" &&
activity.field !== "modules" activity.field !== "modules" &&
activity.field !== "attachment" &&
activity.field !== "link" &&
activity.field !== "estimate"
) { ) {
const { workspace_detail, project, issue } = activity; const { workspace_detail, project, issue } = activity;
value = ( value = (
@ -160,6 +184,12 @@ export const Feeds: React.FC<any> = ({ activities }) => (
value = renderShortNumericDateFormat(date as string); value = renderShortNumericDateFormat(date as string);
} else if (activity.field === "description") { } else if (activity.field === "description") {
value = "description"; value = "description";
} else if (activity.field === "attachment") {
value = "attachment";
} else if (activity.field === "link") {
value = "link";
} else if (activity.field === "estimate") {
value = "estimate";
} }
if (activity.field === "comment") { if (activity.field === "comment") {

View File

@ -8,6 +8,9 @@ import {
CalendarDaysIcon, CalendarDaysIcon,
ChartBarIcon, ChartBarIcon,
ChatBubbleBottomCenterTextIcon, ChatBubbleBottomCenterTextIcon,
LinkIcon,
PaperClipIcon,
PlayIcon,
RectangleGroupIcon, RectangleGroupIcon,
Squares2X2Icon, Squares2X2Icon,
UserIcon, UserIcon,
@ -84,6 +87,18 @@ const activityDetails: {
message: "set the parent to", message: "set the parent to",
icon: <UserIcon className="h-3 w-3 text-gray-500" aria-hidden="true" />, icon: <UserIcon className="h-3 w-3 text-gray-500" aria-hidden="true" />,
}, },
estimate: {
message: "updated the estimate",
icon: <PlayIcon className="h-3 w-3 text-gray-500 -rotate-90" aria-hidden="true" />,
},
link: {
message: "updated the link",
icon: <LinkIcon className="h-3 w-3 text-gray-500" aria-hidden="true" />,
},
attachment: {
message: "updated the attachment",
icon: <PaperClipIcon className="h-3 w-3 text-gray-500 " aria-hidden="true" />,
},
}; };
type Props = {}; type Props = {};
@ -204,13 +219,22 @@ export const IssueActivitySection: React.FC<Props> = () => {
: "removed the priority"; : "removed the priority";
} else if (activityItem.field === "description") { } else if (activityItem.field === "description") {
action = "updated the"; action = "updated the";
} else if (activityItem.field === "attachment") {
action = `${activityItem.verb} the`;
} else if (activityItem.field === "link") {
action = `${activityItem.verb} the`;
} else if (activityItem.field === "estimate") {
action = "updated the";
} }
// for values that are after the action clause // for values that are after the action clause
let value: any = activityItem.new_value ? activityItem.new_value : activityItem.old_value; let value: any = activityItem.new_value ? activityItem.new_value : activityItem.old_value;
if ( if (
activityItem.verb === "created" && activityItem.verb === "created" &&
activityItem.field !== "cycles" && activityItem.field !== "cycles" &&
activityItem.field !== "modules" activityItem.field !== "modules" &&
activityItem.field !== "attachment" &&
activityItem.field !== "link" &&
activityItem.field !== "estimate"
) { ) {
value = <span className="text-gray-600">created this issue.</span>; value = <span className="text-gray-600">created this issue.</span>;
} else if (activityItem.field === "state") { } else if (activityItem.field === "state") {
@ -250,6 +274,12 @@ export const IssueActivitySection: React.FC<Props> = () => {
value = renderShortNumericDateFormat(date as string); value = renderShortNumericDateFormat(date as string);
} else if (activityItem.field === "description") { } else if (activityItem.field === "description") {
value = "description"; value = "description";
} else if (activityItem.field === "attachment") {
value = "attachment";
} else if (activityItem.field === "link") {
value = "link";
} else if (activityItem.field === "estimate") {
value = "estimate";
} }
if ("field" in activityItem && activityItem.field !== "updated_by") { if ("field" in activityItem && activityItem.field !== "updated_by") {