Browse Source

change Meteor.user() to ReactiveCache.getCurrentUser()

- see also: https://github.com/wekan/wekan/issues/5000
Martin Filser 1 year ago
parent
commit
bff96f6ae2

+ 1 - 1
client/components/lists/list.js

@@ -196,7 +196,7 @@ BlazeComponent.extendComponent({
   },
 
   listWidth() {
-    const user = Meteor.user();
+    const user = ReactiveCache.getCurrentUser();
     const list = Template.currentData();
     return user.getListWidth(list.boardId, list._id);
   },

+ 1 - 1
client/components/lists/listHeader.js

@@ -362,7 +362,7 @@ BlazeComponent.extendComponent({
   listWidthValue() {
     const list = Template.currentData();
     const board = list.boardId;
-    return Meteor.user().getListWidth(board, list._id);
+    return ReactiveCache.getCurrentUser().getListWidth(board, list._id);
   },
 
   events() {

+ 1 - 1
client/components/swimlanes/swimlaneHeader.js

@@ -224,7 +224,7 @@ BlazeComponent.extendComponent({
   swimlaneHeightValue() {
     const swimlane = this.currentData();
     const board = swimlane.boardId;
-    return Meteor.user().getSwimlaneHeight(board, swimlane._id);
+    return ReactiveCache.getCurrentUser().getSwimlaneHeight(board, swimlane._id);
   },
 
   events() {

+ 2 - 2
client/components/swimlanes/swimlanes.js

@@ -225,7 +225,7 @@ BlazeComponent.extendComponent({
   },
 
   swimlaneHeight() {
-    const user = Meteor.user();
+    const user = ReactiveCache.getCurrentUser();
     const swimlane = Template.currentData();
     const height = user.getSwimlaneHeight(swimlane.boardId, swimlane._id);
     return height == -1 ? "auto" : (height + "px");
@@ -288,7 +288,7 @@ BlazeComponent.extendComponent({
 
 Template.swimlane.helpers({
   canSeeAddList() {
-    return Meteor.user().isBoardAdmin();
+    return ReactiveCache.getCurrentUser().isBoardAdmin();
   },
 });
 

+ 3 - 3
client/components/users/userHeader.js

@@ -325,7 +325,7 @@ Template.changeSettingsPopup.helpers({
     });
   },
   startDayOfWeek() {
-    currentUser = Meteor.user();
+    currentUser = ReactiveCache.getCurrentUser();
     if (currentUser) {
       return currentUser.getStartDayOfWeek();
     } else {
@@ -343,7 +343,7 @@ Template.changeSettingsPopup.events({
     return ret;
   },
   'click .js-toggle-desktop-drag-handles'() {
-    currentUser = Meteor.user();
+    const currentUser = ReactiveCache.getCurrentUser();
     if (currentUser) {
       Meteor.call('toggleDesktopDragHandles');
     } else if (window.localStorage.getItem('showDesktopDragHandles')) {
@@ -375,7 +375,7 @@ Template.changeSettingsPopup.events({
       templateInstance.$('#start-day-of-week').val(),
       10,
     );
-    const currentUser = Meteor.user();
+    const currentUser = ReactiveCache.getCurrentUser();
     if (isNaN(minLimit) || minLimit < -1) {
       minLimit = -1;
     }

+ 2 - 2
models/users.js

@@ -1248,14 +1248,14 @@ Meteor.methods({
     check(boardId, String);
     check(listId, String);
     check(width, Number);
-    const user = Meteor.user();
+    const user = ReactiveCache.getCurrentUser();
     user.setListWidth(boardId, listId, width);
   },
   applySwimlaneHeight(boardId, swimlaneId, height) {
     check(boardId, String);
     check(swimlaneId, String);
     check(height, Number);
-    const user = Meteor.user();
+    const user = ReactiveCache.getCurrentUser();
     user.setSwimlaneHeight(boardId, swimlaneId, height);
   },
 });