Skip to content

Enforce Consistent Naming and Remove Secretariat Masking in Conversations #1607

@david-rocca

Description

@david-rocca

Ticket: Enforce Consistent Naming and Remove Secretariat Masking in Conversations

Description

Currently, when a Secretariat user posts a message, their name is hardcoded to "Secretariat" in some flows (e.g., processConversationHistory), masking their actual identity. In other flows, it manually concatenates first and last names.
We need to:

  1. Always display the user's actual name, even for Secretariat users.
  2. Standardize how the name is formatted (e.g., "First Last") across the entire application to prevent inconsistencies.

Acceptance Criteria / TODOs

Backend Changes

  • Create Naming Utility:

    • Create a utility function (e.g., getUserFullName(user)) in src/utils/utils.js (or similar) that handles safe concatenation of user.name.first and user.name.last.
    • Handle edge cases (missing first or last name).
  • Refactor ConversationRepository.js:

    • Update processConversationHistory:
      • Remove the ternary operator that force-sets author_name to 'Secretariat' if isSecretariat is true.
      • Use the new utility function to set author_name for all users.
      • Ensure author_role still correctly reflects 'Secretariat' vs 'Partner'.
  • Refactor ConversationController.js:

    • Update createConversationForTargetUUID:
      • Replace the manual [user.name.first, user.name.last].join(' ') with the new utility function.

Testing

  • Unit Tests:
    • Verify that a message created by a Secretariat user now has their actual name in author_name (e.g., "Jane Doe") while author_role remains "Secretariat".
    • Verify that the name formatting is consistent across different creation paths (createConversationForTargetUUID and processConversationHistory).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions