From 69bc52a6832947bbc1015f7e069ac69ffa805772 Mon Sep 17 00:00:00 2001 From: Bharath Kumar Shetty Date: Sat, 5 Dec 2026 11:20:46 +0530 Subject: [PATCH] Show upload times and filenames in work item attachment history --- apps/api/plane/app/serializers/issue.py | 1 + .../serializers/test_attachment_timestamp.py | 27 +++++++++++++++++++ apps/web/components/core/activity.tsx | 3 ++- .../issues/attachment/attachment-detail.tsx | 9 ++++--- .../attachment/attachment-list-item.tsx | 17 +++++++----- .../activity/actions/attachment.tsx | 3 ++- apps/web/helpers/attachment-activity.test.mjs | 23 ++++++++++++++++ apps/web/helpers/attachment-activity.ts | 11 ++++++++ .../issue/issue-details/attachment.store.ts | 8 +++--- packages/types/src/issues/issue_attachment.ts | 1 + 10 files changed, 87 insertions(+), 16 deletions(-) create mode 100644 apps/api/plane/tests/unit/serializers/test_attachment_timestamp.py create mode 100644 apps/web/helpers/attachment-activity.test.mjs create mode 100644 apps/web/helpers/attachment-activity.ts diff --git a/apps/api/plane/app/serializers/issue.py b/apps/api/plane/app/serializers/issue.py index e84207fe6f96..361a57ebe1ae 100644 --- a/apps/api/plane/app/serializers/issue.py +++ b/apps/api/plane/app/serializers/issue.py @@ -652,6 +652,7 @@ class Meta: "asset", "attributes", # "issue_id", + "created_at", "created_by", "updated_at", "updated_by", diff --git a/apps/api/plane/tests/unit/serializers/test_attachment_timestamp.py b/apps/api/plane/tests/unit/serializers/test_attachment_timestamp.py new file mode 100644 index 000000000000..5f5b0290533e --- /dev/null +++ b/apps/api/plane/tests/unit/serializers/test_attachment_timestamp.py @@ -0,0 +1,27 @@ +# Copyright (c) 2023-present Plane Software, Inc. and contributors +# SPDX-License-Identifier: AGPL-3.0-only +# See the LICENSE file for details. + +from datetime import UTC, datetime +from uuid import uuid4 + +import pytest + +from plane.app.serializers.issue import IssueAttachmentLiteSerializer, IssueAttachmentSerializer +from plane.db.models import FileAsset, Workspace + + +@pytest.mark.unit +@pytest.mark.parametrize("serializer", [IssueAttachmentLiteSerializer, IssueAttachmentSerializer]) +def test_work_item_attachment_returns_original_timestamp(serializer): + uploaded = datetime(2026, 1, 1, 10, 30, tzinfo=UTC) + attachment = FileAsset( + workspace=Workspace(id=uuid4(), slug="example"), + project_id=uuid4(), + issue_id=uuid4(), + entity_type=FileAsset.EntityTypeContext.ISSUE_ATTACHMENT, + created_at=uploaded, + updated_at=datetime(2026, 2, 1, tzinfo=UTC), + ) + + assert datetime.fromisoformat(serializer(attachment).data["created_at"]) == uploaded diff --git a/apps/web/components/core/activity.tsx b/apps/web/components/core/activity.tsx index 8b3ea3eb5e85..5b7109f5f616 100644 --- a/apps/web/components/core/activity.tsx +++ b/apps/web/components/core/activity.tsx @@ -5,6 +5,7 @@ */ import { useEffect } from "react"; +import { getAttachmentUploadMessage } from "@/helpers/attachment-activity"; import { observer } from "mobx-react"; import { useParams } from "next/navigation"; // store hooks @@ -204,7 +205,7 @@ const activityDetails: { if (activity.verb === "created") return ( <> - uploaded a new attachment + {getAttachmentUploadMessage(activity.new_value)} {showIssue && ( <> {" "} diff --git a/apps/web/components/issues/attachment/attachment-detail.tsx b/apps/web/components/issues/attachment/attachment-detail.tsx index 2a677020f9db..cf849c3ab589 100644 --- a/apps/web/components/issues/attachment/attachment-detail.tsx +++ b/apps/web/components/issues/attachment/attachment-detail.tsx @@ -57,6 +57,8 @@ export const IssueAttachmentsDetail = observer(function IssueAttachmentsDetail(p if (!attachment) return <>; + const uploadedAt = renderFormattedDate(new Date(attachment.created_at), "MMM dd, yyyy, HH:mm"); + return ( <> {isDeleteIssueAttachmentModalOpen && ( @@ -79,18 +81,17 @@ export const IssueAttachmentsDetail = observer(function IssueAttachmentsDetail(p {fileName} -
+
{fileExtension.toUpperCase()} {convertBytesToSize(attachment.attributes.size)} +
diff --git a/apps/web/components/issues/attachment/attachment-list-item.tsx b/apps/web/components/issues/attachment/attachment-list-item.tsx index afc7b73e69e6..22418c05d1c5 100644 --- a/apps/web/components/issues/attachment/attachment-list-item.tsx +++ b/apps/web/components/issues/attachment/attachment-list-item.tsx @@ -53,6 +53,8 @@ export const IssueAttachmentsListItem = observer(function IssueAttachmentsListIt if (!attachment) return <>; + const uploadedAt = renderFormattedDate(new Date(attachment.created_at), "MMM dd, yyyy, HH:mm"); + return ( <>