mirror of
https://github.com/wekan/wekan.git
synced 2026-02-05 16:11:47 +01:00
Move every Meteor.user() to the ReactiveCache
This commit is contained in:
parent
6e1ef3d94a
commit
5e3a9dc059
42 changed files with 211 additions and 252 deletions
|
|
@ -91,9 +91,6 @@ Template.boardOrgRow.helpers({
|
|||
orgData() {
|
||||
return Org.findOne(this.orgId);
|
||||
},
|
||||
currentUser(){
|
||||
return Meteor.user();
|
||||
},
|
||||
});
|
||||
|
||||
Template.boardOrgName.helpers({
|
||||
|
|
@ -153,9 +150,6 @@ Template.boardTeamRow.helpers({
|
|||
teamData() {
|
||||
return Team.findOne(this.teamId);
|
||||
},
|
||||
currentUser(){
|
||||
return Meteor.user();
|
||||
},
|
||||
});
|
||||
|
||||
Template.boardTeamName.helpers({
|
||||
|
|
@ -182,20 +176,20 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
isSelected() {
|
||||
const userProfile = Meteor.user().profile;
|
||||
const userProfile = ReactiveCache.getCurrentUser().profile;
|
||||
const avatarUrl = userProfile && userProfile.avatarUrl;
|
||||
const currentAvatarUrl = `${this.currentData().link()}?auth=false&brokenIsFine=true`;
|
||||
return avatarUrl === currentAvatarUrl;
|
||||
},
|
||||
|
||||
noAvatarUrl() {
|
||||
const userProfile = Meteor.user().profile;
|
||||
const userProfile = ReactiveCache.getCurrentUser().profile;
|
||||
const avatarUrl = userProfile && userProfile.avatarUrl;
|
||||
return !avatarUrl;
|
||||
},
|
||||
|
||||
setAvatar(avatarUrl) {
|
||||
Meteor.user().setAvatarUrl(avatarUrl);
|
||||
ReactiveCache.getCurrentUser().setAvatarUrl(avatarUrl);
|
||||
},
|
||||
|
||||
setError(error) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
|
||||
Template.headerUserBar.events({
|
||||
|
|
@ -13,18 +14,18 @@ BlazeComponent.extendComponent({
|
|||
|
||||
Template.memberMenuPopup.helpers({
|
||||
templatesBoardId() {
|
||||
currentUser = Meteor.user();
|
||||
const currentUser = ReactiveCache.getCurrentUser();
|
||||
if (currentUser) {
|
||||
return Meteor.user().getTemplatesBoardId();
|
||||
return currentUser.getTemplatesBoardId();
|
||||
} else {
|
||||
// No need to getTemplatesBoardId on public board
|
||||
return false;
|
||||
}
|
||||
},
|
||||
templatesBoardSlug() {
|
||||
currentUser = Meteor.user();
|
||||
const currentUser = ReactiveCache.getCurrentUser();
|
||||
if (currentUser) {
|
||||
return Meteor.user().getTemplatesBoardSlug();
|
||||
return currentUser.getTemplatesBoardSlug();
|
||||
} else {
|
||||
// No need to getTemplatesBoardSlug() on public board
|
||||
return false;
|
||||
|
|
@ -33,7 +34,7 @@ Template.memberMenuPopup.helpers({
|
|||
isSameDomainNameSettingValue(){
|
||||
const currSett = Utils.getCurrentSetting();
|
||||
if(currSett && currSett != undefined && currSett.disableRegistration && currSett.mailDomainName !== undefined && currSett.mailDomainName != ""){
|
||||
currentUser = Meteor.user();
|
||||
currentUser = ReactiveCache.getCurrentUser();
|
||||
if (currentUser) {
|
||||
let found = false;
|
||||
for(let i = 0; i < currentUser.emails.length; i++) {
|
||||
|
|
@ -51,7 +52,7 @@ Template.memberMenuPopup.helpers({
|
|||
return false;
|
||||
},
|
||||
isNotOAuth2AuthenticationMethod(){
|
||||
currentUser = Meteor.user();
|
||||
const currentUser = ReactiveCache.getCurrentUser();
|
||||
if (currentUser) {
|
||||
return currentUser.authenticationMethod.toLowerCase() != 'oauth2';
|
||||
} else {
|
||||
|
|
@ -185,9 +186,9 @@ Template.editProfilePopup.events({
|
|||
'profile.initials': initials,
|
||||
},
|
||||
});
|
||||
isChangeUserName = username !== Meteor.user().username;
|
||||
isChangeUserName = username !== ReactiveCache.getCurrentUser().username;
|
||||
isChangeEmail =
|
||||
email.toLowerCase() !== Meteor.user().emails[0].address.toLowerCase();
|
||||
email.toLowerCase() !== ReactiveCache.getCurrentUser().emails[0].address.toLowerCase();
|
||||
if (isChangeUserName && isChangeEmail) {
|
||||
Meteor.call(
|
||||
'setUsernameAndEmail',
|
||||
|
|
@ -282,7 +283,7 @@ Template.changeLanguagePopup.events({
|
|||
|
||||
Template.changeSettingsPopup.helpers({
|
||||
hiddenSystemMessages() {
|
||||
currentUser = Meteor.user();
|
||||
const currentUser = ReactiveCache.getCurrentUser();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).hasHiddenSystemMessages;
|
||||
} else if (window.localStorage.getItem('hasHiddenSystemMessages')) {
|
||||
|
|
@ -292,7 +293,7 @@ Template.changeSettingsPopup.helpers({
|
|||
}
|
||||
},
|
||||
rescueCardDescription() {
|
||||
currentUser = Meteor.user();
|
||||
const currentUser = ReactiveCache.getCurrentUser();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).rescueCardDescription;
|
||||
} else if (window.localStorage.getItem('rescueCardDescription')) {
|
||||
|
|
@ -302,9 +303,9 @@ Template.changeSettingsPopup.helpers({
|
|||
}
|
||||
},
|
||||
showCardsCountAt() {
|
||||
currentUser = Meteor.user();
|
||||
const currentUser = ReactiveCache.getCurrentUser();
|
||||
if (currentUser) {
|
||||
return Meteor.user().getLimitToShowCardsCount();
|
||||
return currentUser.getLimitToShowCardsCount();
|
||||
} else {
|
||||
return window.localStorage.getItem('limitToShowCardsCount');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue