Skip to content

Commit

Permalink
STSMACOM-858: Display Unknown user when the creator was deleted (fo…
Browse files Browse the repository at this point in the history
…llow-up) (#1521)

* STSMACOM-858: Display 'System' user when there is no 'updatedByUserId' field in metadata

* STSMACOM-858: Fix tests

* STSMACOM-858: Display 'Unknown user' when the creator was deleted

* STSMACOM-858: Update unit tests

* STSMACOM-858: Update unit tests

* STSMACOM-858: Update unit tests

* STSMACOM-858: Use translation from stripes-components
  • Loading branch information
OleksandrHladchenko1 authored Oct 7, 2024
1 parent 1fd99db commit f3be7f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/ControlledVocab/ControlledVocab.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ class ControlledVocab extends React.Component {
user = <Link to={`/users/view/${metadata.updatedByUserId}`}>{name}</Link>;
} else if (metadata.updatedByUserId === SYSTEM_USER_ID || !metadata.updatedByUserId) {
user = <FormattedMessage id="stripes-smart-components.system" />;
} else {
user = <FormattedMessage id="stripes-components.metaSection.unknownUser" />;
}

return (
Expand Down
4 changes: 2 additions & 2 deletions lib/ControlledVocab/tests/ControlledVocab-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ describe('ControlledVocab', () => {

it('should have row count 7', () => cv.has({ rowCount: 7 }));

it('should render the row with last updated by user-1 without user firstname or lastname', async () => {
await mcl.find(MultiColumnListCell({ row: 4, columnIndex: 3, content: '4/18/2019 by ' })).exists();
it('should render the row with last updated by unknown user without user firstname or lastname', async () => {
await mcl.find(MultiColumnListCell({ row: 5, columnIndex: 3, content: '4/18/2019 by Unknown user' })).exists();
});

it('should render the row with last updated by system with "System" text', async () => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"node": ">=14.0.0"
},
"stripes": {
"actsAs": [],
"okapiInterfaces": {
"notes": "2.0 3.0",
"tags": "1.0",
Expand Down

0 comments on commit f3be7f9

Please sign in to comment.