ソースを参照

Add profile.keyboardShortcuts to User model

Nadav Tasher 5 ヶ月 前
コミット
658e43ab54
1 ファイル変更20 行追加0 行削除
  1. 20 0
      models/users.js

+ 20 - 0
models/users.js

@@ -444,6 +444,13 @@ Users.attachSchema(
       defaultValue: {},
       blackbox: true,
     },
+    'profile.keyboardShortcuts': {
+      /**
+       * User-specified state of keyboard shortcut activation.
+       */
+      type: Boolean,
+      defaultValue: true,
+    },
     services: {
       /**
        * services field of the user
@@ -954,6 +961,11 @@ Users.helpers({
     return 'templates';
   },
 
+  isKeyboardShortcuts() {
+    const { keyboardShortcuts = false } = this.profile || {};
+    return keyboardShortcuts;
+  },
+
   remove() {
     User.remove({
       _id: this._id,
@@ -1018,6 +1030,14 @@ Users.mutations({
       },
     };
   },
+  toggleKeyboardShortcuts() {
+    const { keyboardShortcuts = false } = this.profile || {};
+    return {
+      $set: {
+        'profile.keyboardShortcuts': !keyboardShortcuts,
+      },
+    };
+  },
 
   addInvite(boardId) {
     return {