CHI-3707: Identify current user in conversation with separate check for masking purposes#3872
Conversation
|
@copilot - extend the unit test coverage for this redux subscribe function to cover the new check It should test that if the identity of the participant matches the identity of the user from the Flex manager, it should be identified as an agent, irrespective of other checks |
|
@stephenhand I've opened a new pull request, #3873, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot - extend the unit test coverage for this redux subscribe function to cover the new check It should test that if the identity of the participant matches the identity of the user from the Flex manager, it should be identified as an agent, irrespective of other checks Run eslint for plugin-hrm-form and fix any issues raised in addition to any other checks prior to requesting reviews for any changes |
|
@stephenhand I've opened a new pull request, #3876, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
CHI-3707: Add test coverage for current user identity check in masking logic
There was a problem hiding this comment.
Pull request overview
This PR adds an explicit check to identify the current user (agent) in conversation participants for masking purposes. The change addresses a need for more specific identification of the current agent, adding a priority check that compares participant identities with the logged-in user's identity before falling back to other agent identification methods.
Changes:
- Added a first-priority identity comparison check to identify the current user as an agent
- Enhanced test suite with three new test cases covering scenarios where participant identity matches the manager user identity
- Ensured the current user is never masked regardless of other attributes like member_type
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| plugin-hrm-form/src/maskIdentifiers/index.ts | Added identity comparison as the first condition in agent identification logic, checking if participant identity matches manager user identity |
| plugin-hrm-form/src/_tests/maskIdentifiers/index.test.ts | Added test cases and updated test helper to support identity parameter, covering scenarios where current user identity matching takes precedence |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| each([ | ||
| { | ||
| testCase: 'identity matches manager user identity, regardless of other checks', | ||
| participantAttributes: {}, | ||
| participantIdentity: 'current-user-identity', | ||
| flexParticipants: {}, | ||
| expectedName: 'Original Name', | ||
| }, | ||
| { | ||
| testCase: 'identity matches manager user identity, even with guest member_type', | ||
| participantAttributes: { member_type: 'guest' }, | ||
| participantIdentity: 'current-user-identity', | ||
| flexParticipants: {}, | ||
| expectedName: 'Original Name', | ||
| }, | ||
| { | ||
| testCase: 'identity matches manager user identity, even when not in flex store', | ||
| participantAttributes: {}, | ||
| participantIdentity: 'current-user-identity', | ||
| flexParticipants: { participant1: { type: 'customer', sid: 'MB999' } }, | ||
| expectedName: 'Original Name', | ||
| }, |
There was a problem hiding this comment.
Consider adding a test case where manager.user.identity is undefined or null to ensure the new identity check handles this edge case correctly. This would verify that participants aren't incorrectly identified as agents when both identities are missing.
Description
Now we are more cautious about identifying a particiapant as an agent for masking purposes, we need a specific check for the current agent.
Checklist
Other Related Issues
None
Verification steps
AFTER YOU MERGE
You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P