Explorar o código

Adjust 'add-profile-view' in migrations.js in attempt to resolve 1675

RJevnikar %!s(int64=7) %!d(string=hai) anos
pai
achega
4787a1186b
Modificáronse 1 ficheiros con 8 adicións e 6 borrados
  1. 8 6
      server/migrations.js

+ 8 - 6
server/migrations.js

@@ -211,12 +211,14 @@ Migrations.add('add-checklist-items', () => {
 
 Migrations.add('add-profile-view', () => {
   Users.find().forEach((user) => {
-    // Set default view
-    Users.direct.update(
-      { _id: user._id },
-      { $set: { 'profile.boardView': 'board-view-lists' } },
-      noValidate
-    );
+    if (!user.hasOwnProperty('profile.boardView')) {
+      // Set default view
+      Users.direct.update(
+        { _id: user._id },
+        { $set: { 'profile.boardView': 'board-view-lists' } },
+        noValidate
+      );
+    }
   });
 });