Skip to content

Conversation

@program-the-brain-not-the-heartbeat
Copy link
Contributor

This PR adds the UI functionality for activity logs for adding and removing attachments to a card.
The backend already created database rows for the attachment, it just wasn't rendered on the frontend.

This closes #354

Things to note:

  • const MAX_SIZE_BYTES = 50 * 1024 * 1024; // 50MB hardcoded and does not respect NEXT_API_BODY_SIZE_LIMIT, made a FIXME comment.
  • NEXT_API_BODY_SIZE_LIMIT does not look like it is utilized anywhere in the code.
firefox_hxsBkMdwKm3KHPBM

await cardActivityRepo.create(ctx.db, {
type: "card.updated.attachment.added",
cardId: card.id,
toTitle: input.originalFilename,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hijacking the toTitle column we should extend the card_activity schema to reference attachmentId and join onto card_attachment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can then reference filename directly - also it will give us more flexibility to include other info on the upload attachment in future

if (type === "card.updated.attachment.added" && toTitle) {
return (
<Trans>
added attachment <TextHighlight>{truncate(toTitle)}</TextHighlight>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to include a fallback if filename doesn't exist (for activities created before these changes)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added an attachment is probably fine

Copy link
Contributor

@hjball hjball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @program-the-brain-not-the-heartbeat, I've left a few comments but otherwise lgtm

@program-the-brain-not-the-heartbeat
Copy link
Contributor Author

Sounds good @hjball, I will take a look at this again tomorrow.

For the MAX_SIZE_BYTES, we should subtract a sane number (maybe somewhere between 1 and 4mb) from the NEXT_API_BODY_SIZE_LIMIT as we will need some buffer for the form's data plus the attachment.

I think for most use cases, 1mb form data + attachment size will work and not affect nginx or returning 413 too large http status code.

@hjball
Copy link
Contributor

hjball commented Feb 11, 2026

Is this still in draft? @program-the-brain-not-the-heartbeat

@program-the-brain-not-the-heartbeat
Copy link
Contributor Author

Yes, @hjball -- I want to do some more testing before publishing.
I will aim to do this and a few other issues this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Activity log for uploading attachments

2 participants