[GH-ISSUE #2071] Audit log messages require refactoring #593

Closed
opened 2026-02-26 18:47:43 +03:00 by kerem · 0 comments
Owner

Originally created by @mKoonrad on GitHub (Oct 10, 2025).
Original GitHub issue: https://github.com/documenso/documenso/issues/2071

Issue Description

Currently, function formatDocumentAuditLogAction in packages/lib/utils/document-audit-logs.ts has a slightly convoluted logic for generating user-facing descriptions of audit log events. It combines the logic for the currently logged-in user ("You") and other identified users into a single prefix variable. This leads to less clear messages.

This is especially problematic for languages with grammatical cases (e.g., Polish), where the form of a noun, verb or pronoun changes depending on its role in a sentence (declension). A simple concatenation like ${prefix} added a field is difficult to translate correctly. Separating messages for "You" (you) and "another user" (identified) allows translators to provide grammatically correct sentences for each context.

Steps to Reproduce

See audit logs with identified case texts.

Expected Behavior

Refactoring this function to handle 3 cases for each audit log event:

  1. (currently) anonymous
  2. (currently) identified: The action was performed by another known user, but not "you"
  3. you: The action was performed by the user currently viewing the log.

Example:

.with({ type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_CREATED }, () => ({
      anonymous: msg({
        message: `A field was added`,
        context: `Audit log format`,
      }),
      identified: msg`${prefix} added a field`,
      you: msg`You added a field`, // New case
    }))

Current Behavior

Incorrect grammatical texts for each case.

Screenshots (optional)

No response

Operating System [e.g., Windows 10]

Windows 11

Browser [e.g., Chrome, Firefox]

Chrome

Version [e.g., 2.0.1]

Documenso v1.13.0

Please check the boxes that apply to this issue report.

  • I have searched the existing issues to make sure this is not a duplicate.
  • I have provided steps to reproduce the issue.
  • I have included relevant environment information.
  • I have included any relevant screenshots.
  • I understand that this is a voluntary contribution and that there is no guarantee of resolution.
  • I want to work on creating a PR for this issue if approved
Originally created by @mKoonrad on GitHub (Oct 10, 2025). Original GitHub issue: https://github.com/documenso/documenso/issues/2071 ### Issue Description Currently, function `formatDocumentAuditLogAction` in [packages/lib/utils/document-audit-logs.ts](https://github.com/documenso/documenso/blob/7b17156e567ac921cf5908371d3cafb77ed2acf9/packages/lib/utils/document-audit-logs.ts) has a slightly convoluted logic for generating user-facing descriptions of audit log events. It combines the logic for the currently logged-in user ("You") and other identified users into a single prefix variable. This leads to less clear messages. This is especially problematic for languages with grammatical cases (e.g., Polish), where the form of a noun, verb or pronoun changes depending on its role in a sentence (declension). A simple concatenation like `${prefix} added a field` is difficult to translate correctly. Separating messages for "You" (you) and "another user" (identified) allows translators to provide grammatically correct sentences for each context. ### Steps to Reproduce See audit logs with identified case texts. ### Expected Behavior Refactoring this function to handle 3 cases for each audit log event: 1. (currently) `anonymous` 2. (currently) `identified`: The action was performed by another known user, but not "you" 3. `you`: The action was performed by the user currently viewing the log. Example: ``` .with({ type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_CREATED }, () => ({ anonymous: msg({ message: `A field was added`, context: `Audit log format`, }), identified: msg`${prefix} added a field`, you: msg`You added a field`, // New case })) ``` ### Current Behavior Incorrect grammatical texts for each case. ### Screenshots (optional) _No response_ ### Operating System [e.g., Windows 10] Windows 11 ### Browser [e.g., Chrome, Firefox] Chrome ### Version [e.g., 2.0.1] Documenso v1.13.0 ### Please check the boxes that apply to this issue report. - [x] I have searched the existing issues to make sure this is not a duplicate. - [x] I have provided steps to reproduce the issue. - [x] I have included relevant environment information. - [ ] I have included any relevant screenshots. - [x] I understand that this is a voluntary contribution and that there is no guarantee of resolution. - [x] I want to work on creating a PR for this issue if approved
kerem 2026-02-26 18:47:43 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#593
No description provided.