Skip to content

Commit d46a226

Browse files
committed
Update snapshots.transformer.js to assume null UserId == Auto Snapshot
1 parent 937807d commit d46a226

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

frontend/src/transformers/snapshots.transformer.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
* @returns Array of snapshots with user details applied
77
*/
88
function applySystemUserDetails (snapshots, owner) {
9-
// For any snapshots that have no user and match the autoSnapshot name format
10-
// we mimic a user so that the table can display the device name and a suitable image
11-
// NOTE: Any changes to the below regex should be reflected in forge/db/controllers/ProjectSnapshot.js
12-
const autoSnapshotRegex = /^Auto Snapshot - \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/ // e.g "Auto Snapshot - 2023-02-01 12:34:56"
9+
// For any snapshots that have no user we mimic a system-user so that the table can display the device name and a suitable image
1310
return snapshots.map((snapshot) => {
14-
if (!snapshot.user && autoSnapshotRegex.test(snapshot.name)) {
11+
if (!snapshot.user) {
1512
snapshot.user = {
1613
name: owner?.name || (snapshot.project || snapshot.device || {}).name || 'Unknown',
1714
username: 'Auto Snapshot',

0 commit comments

Comments
 (0)