mirror of
https://github.com/wekan/wekan.git
synced 2025-12-27 12:48:49 +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
|
|
@ -25,7 +25,7 @@ BlazeComponent.extendComponent({
|
||||||
searchId = Session.get(`current${capitalizedMode}`);
|
searchId = Session.get(`current${capitalizedMode}`);
|
||||||
}
|
}
|
||||||
const limit = this.page.get() * activitiesPerPage;
|
const limit = this.page.get() * activitiesPerPage;
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
const hideSystem = user ? user.hasHiddenSystemMessages() : false;
|
const hideSystem = user ? user.hasHiddenSystemMessages() : false;
|
||||||
if (searchId === null) return;
|
if (searchId === null) return;
|
||||||
|
|
||||||
|
|
@ -283,7 +283,7 @@ Template.activity.helpers({
|
||||||
|
|
||||||
Template.commentReactions.events({
|
Template.commentReactions.events({
|
||||||
'click .reaction'(event) {
|
'click .reaction'(event) {
|
||||||
if (Meteor.user().isBoardMember()) {
|
if (ReactiveCache.getCurrentUser().isBoardMember()) {
|
||||||
const codepoint = event.currentTarget.dataset['codepoint'];
|
const codepoint = event.currentTarget.dataset['codepoint'];
|
||||||
const commentId = Template.instance().data.commentId;
|
const commentId = Template.instance().data.commentId;
|
||||||
const cardComment = CardComments.findOne({_id: commentId});
|
const cardComment = CardComments.findOne({_id: commentId});
|
||||||
|
|
@ -295,7 +295,7 @@ Template.commentReactions.events({
|
||||||
|
|
||||||
Template.addReactionPopup.events({
|
Template.addReactionPopup.events({
|
||||||
'click .add-comment-reaction'(event) {
|
'click .add-comment-reaction'(event) {
|
||||||
if (Meteor.user().isBoardMember()) {
|
if (ReactiveCache.getCurrentUser().isBoardMember()) {
|
||||||
const codepoint = event.currentTarget.dataset['codepoint'];
|
const codepoint = event.currentTarget.dataset['codepoint'];
|
||||||
const commentId = Template.instance().data.commentId;
|
const commentId = Template.instance().data.commentId;
|
||||||
const cardComment = CardComments.findOne({_id: commentId});
|
const cardComment = CardComments.findOne({_id: commentId});
|
||||||
|
|
@ -326,7 +326,7 @@ Template.addReactionPopup.helpers({
|
||||||
|
|
||||||
Template.commentReactions.helpers({
|
Template.commentReactions.helpers({
|
||||||
isSelected(userIds) {
|
isSelected(userIds) {
|
||||||
return userIds.includes(Meteor.user()._id);
|
return Meteor.userId() && userIds.includes(Meteor.userId());
|
||||||
},
|
},
|
||||||
userNames(userIds) {
|
userNames(userIds) {
|
||||||
return Users.find({_id: {$in: userIds}})
|
return Users.find({_id: {$in: userIds}})
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
this.subscribe('archivedBoards');
|
this.subscribe('archivedBoards');
|
||||||
},
|
},
|
||||||
|
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
|
|
||||||
archivedBoards() {
|
archivedBoards() {
|
||||||
|
|
|
||||||
|
|
@ -205,11 +205,10 @@ BlazeComponent.extendComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable drag-dropping if the current user is not a board member
|
// Disable drag-dropping if the current user is not a board member
|
||||||
//$swimlanesDom.sortable('option', 'disabled', !userIsMember());
|
|
||||||
$swimlanesDom.sortable(
|
$swimlanesDom.sortable(
|
||||||
'option',
|
'option',
|
||||||
'disabled',
|
'disabled',
|
||||||
!Meteor.user() || !Meteor.user().isBoardAdmin(),
|
!ReactiveCache.getCurrentUser()?.isBoardAdmin(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -232,7 +231,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isViewSwimlanes() {
|
isViewSwimlanes() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).boardView === 'board-view-swimlanes';
|
return (currentUser.profile || {}).boardView === 'board-view-swimlanes';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -243,7 +242,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isViewLists() {
|
isViewLists() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).boardView === 'board-view-lists';
|
return (currentUser.profile || {}).boardView === 'board-view-lists';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -252,7 +251,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isViewCalendar() {
|
isViewCalendar() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -418,7 +417,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
select: function(startDate) {
|
select: function(startDate) {
|
||||||
const currentBoard = Utils.getCurrentBoard();
|
const currentBoard = Utils.getCurrentBoard();
|
||||||
const currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
const $modal = $(`
|
const $modal = $(`
|
||||||
<div class="modal fade" tabindex="-1" role="dialog">
|
<div class="modal fade" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog justify-content-center align-items-center" role="document">
|
<div class="modal-dialog justify-content-center align-items-center" role="document">
|
||||||
|
|
@ -459,7 +458,7 @@ BlazeComponent.extendComponent({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
isViewCalendar() {
|
isViewCalendar() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -64,7 +65,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
isStarred() {
|
isStarred() {
|
||||||
const boardId = Session.get('currentBoard');
|
const boardId = Session.get('currentBoard');
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
return user && user.hasStarred(boardId);
|
return user && user.hasStarred(boardId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -75,7 +76,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
showSort() {
|
showSort() {
|
||||||
return Meteor.user().hasSortBy();
|
return ReactiveCache.getCurrentUser().hasSortBy();
|
||||||
},
|
},
|
||||||
directionClass() {
|
directionClass() {
|
||||||
return this.currentDirection() === -1 ? DOWNCLS : UPCLS;
|
return this.currentDirection() === -1 ? DOWNCLS : UPCLS;
|
||||||
|
|
@ -85,10 +86,10 @@ BlazeComponent.extendComponent({
|
||||||
Meteor.call('setListSortBy', direction + this.currentListSortBy());
|
Meteor.call('setListSortBy', direction + this.currentListSortBy());
|
||||||
},
|
},
|
||||||
currentDirection() {
|
currentDirection() {
|
||||||
return Meteor.user().getListSortByDirection();
|
return ReactiveCache.getCurrentUser().getListSortByDirection();
|
||||||
},
|
},
|
||||||
currentListSortBy() {
|
currentListSortBy() {
|
||||||
return Meteor.user().getListSortBy();
|
return ReactiveCache.getCurrentUser().getListSortBy();
|
||||||
},
|
},
|
||||||
listSortShortDesc() {
|
listSortShortDesc() {
|
||||||
return `list-label-short-${this.currentListSortBy()}`;
|
return `list-label-short-${this.currentListSortBy()}`;
|
||||||
|
|
@ -99,7 +100,7 @@ BlazeComponent.extendComponent({
|
||||||
{
|
{
|
||||||
'click .js-edit-board-title': Popup.open('boardChangeTitle'),
|
'click .js-edit-board-title': Popup.open('boardChangeTitle'),
|
||||||
'click .js-star-board'() {
|
'click .js-star-board'() {
|
||||||
Meteor.user().toggleBoardStar(Session.get('currentBoard'));
|
ReactiveCache.getCurrentUser().toggleBoardStar(Session.get('currentBoard'));
|
||||||
},
|
},
|
||||||
'click .js-open-board-menu': Popup.open('boardMenu'),
|
'click .js-open-board-menu': Popup.open('boardMenu'),
|
||||||
'click .js-change-visibility': Popup.open('boardChangeVisibility'),
|
'click .js-change-visibility': Popup.open('boardChangeVisibility'),
|
||||||
|
|
@ -306,7 +307,7 @@ const CreateBoard = BlazeComponent.extendComponent({
|
||||||
onSubmit(event) {
|
onSubmit(event) {
|
||||||
super.onSubmit(event);
|
super.onSubmit(event);
|
||||||
// Immediately star boards crated with the headerbar popup.
|
// Immediately star boards crated with the headerbar popup.
|
||||||
Meteor.user().toggleBoardStar(this.boardId.get());
|
ReactiveCache.getCurrentUser().toggleBoardStar(this.boardId.get());
|
||||||
}
|
}
|
||||||
}.register('headerBarCreateBoardPopup'));
|
}.register('headerBarCreateBoardPopup'));
|
||||||
|
|
||||||
|
|
@ -377,7 +378,7 @@ BlazeComponent.extendComponent({
|
||||||
allowedSortValues() {
|
allowedSortValues() {
|
||||||
const types = [];
|
const types = [];
|
||||||
const pushed = {};
|
const pushed = {};
|
||||||
Meteor.user()
|
ReactiveCache.getCurrentUser()
|
||||||
.getListSortTypes()
|
.getListSortTypes()
|
||||||
.forEach(type => {
|
.forEach(type => {
|
||||||
const key = type.replace(/^-/, '');
|
const key = type.replace(/^-/, '');
|
||||||
|
|
@ -393,16 +394,16 @@ BlazeComponent.extendComponent({
|
||||||
return types;
|
return types;
|
||||||
},
|
},
|
||||||
Direction() {
|
Direction() {
|
||||||
return Meteor.user().getListSortByDirection() === -1
|
return ReactiveCache.getCurrentUser().getListSortByDirection() === -1
|
||||||
? this.downClass
|
? this.downClass
|
||||||
: this.upClass;
|
: this.upClass;
|
||||||
},
|
},
|
||||||
sortby() {
|
sortby() {
|
||||||
return Meteor.user().getListSortBy();
|
return ReactiveCache.getCurrentUser().getListSortBy();
|
||||||
},
|
},
|
||||||
|
|
||||||
setSortBy(type = null) {
|
setSortBy(type = null) {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
if (type === null) {
|
if (type === null) {
|
||||||
type = user._getListSortBy();
|
type = user._getListSortBy();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@ Template.boardListHeaderBar.helpers({
|
||||||
//}
|
//}
|
||||||
},
|
},
|
||||||
templatesBoardId() {
|
templatesBoardId() {
|
||||||
return Meteor.user() && Meteor.user().getTemplatesBoardId();
|
return ReactiveCache.getCurrentUser()?.getTemplatesBoardId();
|
||||||
},
|
},
|
||||||
templatesBoardSlug() {
|
templatesBoardSlug() {
|
||||||
return Meteor.user() && Meteor.user().getTemplatesBoardSlug();
|
return ReactiveCache.getCurrentUser()?.getTemplatesBoardSlug();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
Meteor.subscribe('setting');
|
Meteor.subscribe('setting');
|
||||||
Meteor.subscribe('tableVisibilityModeSettings');
|
Meteor.subscribe('tableVisibilityModeSettings');
|
||||||
let currUser = Meteor.user();
|
let currUser = ReactiveCache.getCurrentUser();
|
||||||
let userLanguage;
|
let userLanguage;
|
||||||
if (currUser && currUser.profile) {
|
if (currUser && currUser.profile) {
|
||||||
userLanguage = currUser.profile.language
|
userLanguage = currUser.profile.language
|
||||||
|
|
@ -100,51 +100,34 @@ BlazeComponent.extendComponent({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
userHasTeams() {
|
userHasTeams() {
|
||||||
if (Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0)
|
if (ReactiveCache.getCurrentUser()?.teams?.length > 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
teamsDatas() {
|
teamsDatas() {
|
||||||
if (Meteor.user().teams)
|
const teams = ReactiveCache.getCurrentUser()?.teams
|
||||||
return Meteor.user().teams.sort((a, b) => a.teamDisplayName.localeCompare(b.teamDisplayName));
|
if (teams)
|
||||||
|
return teams.sort((a, b) => a.teamDisplayName.localeCompare(b.teamDisplayName));
|
||||||
else
|
else
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
userHasOrgs() {
|
userHasOrgs() {
|
||||||
if (Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
if (ReactiveCache.getCurrentUser()?.orgs?.length > 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
userHasTemplates(){
|
|
||||||
if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
orgsDatas() {
|
orgsDatas() {
|
||||||
if (Meteor.user().orgs)
|
const orgs = ReactiveCache.getCurrentUser()?.orgs;
|
||||||
return Meteor.user().orgs.sort((a, b) => a.orgDisplayName.localeCompare(b.orgDisplayName));
|
if (orgs)
|
||||||
|
return orgs.sort((a, b) => a.orgDisplayName.localeCompare(b.orgDisplayName));
|
||||||
else
|
else
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
userHasOrgsOrTeams() {
|
userHasOrgsOrTeams() {
|
||||||
let boolUserHasOrgs;
|
const ret = this.userHasOrgs() || this.userHasTeams();
|
||||||
if (Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
return ret;
|
||||||
boolUserHasOrgs = true;
|
|
||||||
else
|
|
||||||
boolUserHasOrgs = false;
|
|
||||||
|
|
||||||
let boolUserHasTeams;
|
|
||||||
if (Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0)
|
|
||||||
boolUserHasTeams = true;
|
|
||||||
else
|
|
||||||
boolUserHasTeams = false;
|
|
||||||
|
|
||||||
return (boolUserHasOrgs || boolUserHasTeams);
|
|
||||||
},
|
},
|
||||||
boards() {
|
boards() {
|
||||||
let query = {
|
let query = {
|
||||||
|
|
@ -227,11 +210,11 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isStarred() {
|
isStarred() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
return user && user.hasStarred(this.currentData()._id);
|
return user && user.hasStarred(this.currentData()._id);
|
||||||
},
|
},
|
||||||
isAdministrable() {
|
isAdministrable() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
return user && user.isBoardAdmin(this.currentData()._id);
|
return user && user.isBoardAdmin(this.currentData()._id);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -246,7 +229,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isInvited() {
|
isInvited() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
return user && user.isInvitedTo(this.currentData()._id);
|
return user && user.isInvitedTo(this.currentData()._id);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -256,7 +239,7 @@ BlazeComponent.extendComponent({
|
||||||
'click .js-add-board': Popup.open('createBoard'),
|
'click .js-add-board': Popup.open('createBoard'),
|
||||||
'click .js-star-board'(evt) {
|
'click .js-star-board'(evt) {
|
||||||
const boardId = this.currentData()._id;
|
const boardId = this.currentData()._id;
|
||||||
Meteor.user().toggleBoardStar(boardId);
|
ReactiveCache.getCurrentUser().toggleBoardStar(boardId);
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
},
|
},
|
||||||
'click .js-clone-board'(evt) {
|
'click .js-clone-board'(evt) {
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ Template.attachmentViewer.events({
|
||||||
|
|
||||||
Template.attachmentGallery.helpers({
|
Template.attachmentGallery.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
fileSize(size) {
|
fileSize(size) {
|
||||||
const ret = filesize(size);
|
const ret = filesize(size);
|
||||||
|
|
|
||||||
|
|
@ -64,16 +64,16 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
hiddenSystemMessages() {
|
hiddenSystemMessages() {
|
||||||
return Meteor.user().hasHiddenSystemMessages();
|
return ReactiveCache.getCurrentUser().hasHiddenSystemMessages();
|
||||||
},
|
},
|
||||||
|
|
||||||
customFieldsGrid() {
|
customFieldsGrid() {
|
||||||
return Meteor.user().hasCustomFieldsGrid();
|
return ReactiveCache.getCurrentUser().hasCustomFieldsGrid();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
cardMaximized() {
|
cardMaximized() {
|
||||||
return !Utils.getPopupCardId() && Meteor.user().hasCardMaximized();
|
return !Utils.getPopupCardId() && ReactiveCache.getCurrentUser().hasCardMaximized();
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollParentContainer() {
|
scrollParentContainer() {
|
||||||
|
|
@ -193,7 +193,7 @@ BlazeComponent.extendComponent({
|
||||||
cardId: card._id,
|
cardId: card._id,
|
||||||
boardId: card.boardId,
|
boardId: card.boardId,
|
||||||
listId: card.listId,
|
listId: card.listId,
|
||||||
user: Meteor.user().username,
|
user: ReactiveCache.getCurrentUser().username,
|
||||||
url: '',
|
url: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -288,7 +288,7 @@ BlazeComponent.extendComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
function userIsMember() {
|
function userIsMember() {
|
||||||
return Meteor.user() && Meteor.user().isBoardMember();
|
return ReactiveCache.getCurrentUser()?.isBoardMember();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable sorting if the current user is not a board member
|
// Disable sorting if the current user is not a board member
|
||||||
|
|
@ -652,7 +652,7 @@ Template.cardDetailsActionsPopup.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -814,11 +814,11 @@ Template.editCardAssignerForm.events({
|
||||||
/** Move Card Dialog */
|
/** Move Card Dialog */
|
||||||
(class extends DialogWithBoardSwimlaneList {
|
(class extends DialogWithBoardSwimlaneList {
|
||||||
getDialogOptions() {
|
getDialogOptions() {
|
||||||
const ret = Meteor.user().getMoveAndCopyDialogOptions();
|
const ret = ReactiveCache.getCurrentUser().getMoveAndCopyDialogOptions();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
setDone(boardId, swimlaneId, listId, options) {
|
setDone(boardId, swimlaneId, listId, options) {
|
||||||
Meteor.user().setMoveAndCopyDialogOption(this.currentBoardId, options);
|
ReactiveCache.getCurrentUser().setMoveAndCopyDialogOption(this.currentBoardId, options);
|
||||||
const card = this.data();
|
const card = this.data();
|
||||||
const minOrder = card.getMinSort(listId, swimlaneId);
|
const minOrder = card.getMinSort(listId, swimlaneId);
|
||||||
card.move(boardId, swimlaneId, listId, minOrder - 1);
|
card.move(boardId, swimlaneId, listId, minOrder - 1);
|
||||||
|
|
@ -828,11 +828,11 @@ Template.editCardAssignerForm.events({
|
||||||
/** Copy Card Dialog */
|
/** Copy Card Dialog */
|
||||||
(class extends DialogWithBoardSwimlaneList {
|
(class extends DialogWithBoardSwimlaneList {
|
||||||
getDialogOptions() {
|
getDialogOptions() {
|
||||||
const ret = Meteor.user().getMoveAndCopyDialogOptions();
|
const ret = ReactiveCache.getCurrentUser().getMoveAndCopyDialogOptions();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
setDone(boardId, swimlaneId, listId, options) {
|
setDone(boardId, swimlaneId, listId, options) {
|
||||||
Meteor.user().setMoveAndCopyDialogOption(this.currentBoardId, options);
|
ReactiveCache.getCurrentUser().setMoveAndCopyDialogOption(this.currentBoardId, options);
|
||||||
const card = this.data();
|
const card = this.data();
|
||||||
|
|
||||||
// const textarea = $('#copy-card-title');
|
// const textarea = $('#copy-card-title');
|
||||||
|
|
@ -855,11 +855,11 @@ Template.editCardAssignerForm.events({
|
||||||
/** Convert Checklist-Item to card dialog */
|
/** Convert Checklist-Item to card dialog */
|
||||||
(class extends DialogWithBoardSwimlaneList {
|
(class extends DialogWithBoardSwimlaneList {
|
||||||
getDialogOptions() {
|
getDialogOptions() {
|
||||||
const ret = Meteor.user().getMoveAndCopyDialogOptions();
|
const ret = ReactiveCache.getCurrentUser().getMoveAndCopyDialogOptions();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
setDone(boardId, swimlaneId, listId, options) {
|
setDone(boardId, swimlaneId, listId, options) {
|
||||||
Meteor.user().setMoveAndCopyDialogOption(this.currentBoardId, options);
|
ReactiveCache.getCurrentUser().setMoveAndCopyDialogOption(this.currentBoardId, options);
|
||||||
const card = this.data();
|
const card = this.data();
|
||||||
|
|
||||||
const textarea = this.$('#copy-card-title');
|
const textarea = this.$('#copy-card-title');
|
||||||
|
|
@ -885,11 +885,11 @@ Template.editCardAssignerForm.events({
|
||||||
/** Copy many cards dialog */
|
/** Copy many cards dialog */
|
||||||
(class extends DialogWithBoardSwimlaneList {
|
(class extends DialogWithBoardSwimlaneList {
|
||||||
getDialogOptions() {
|
getDialogOptions() {
|
||||||
const ret = Meteor.user().getMoveAndCopyDialogOptions();
|
const ret = ReactiveCache.getCurrentUser().getMoveAndCopyDialogOptions();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
setDone(boardId, swimlaneId, listId, options) {
|
setDone(boardId, swimlaneId, listId, options) {
|
||||||
Meteor.user().setMoveAndCopyDialogOption(this.currentBoardId, options);
|
ReactiveCache.getCurrentUser().setMoveAndCopyDialogOption(this.currentBoardId, options);
|
||||||
const card = this.data();
|
const card = this.data();
|
||||||
|
|
||||||
const textarea = this.$('#copy-card-title');
|
const textarea = this.$('#copy-card-title');
|
||||||
|
|
@ -966,7 +966,7 @@ BlazeComponent.extendComponent({
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
_id: {
|
_id: {
|
||||||
$ne: Meteor.user().getTemplatesBoardId(),
|
$ne: ReactiveCache.getCurrentUser().getTemplatesBoardId(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -1563,8 +1563,8 @@ EscapeActions.register(
|
||||||
() => {
|
() => {
|
||||||
// if card description diverges from database due to editing
|
// if card description diverges from database due to editing
|
||||||
// ask user whether changes should be applied
|
// ask user whether changes should be applied
|
||||||
if (Meteor.user()) {
|
if (ReactiveCache.getCurrentUser()) {
|
||||||
if (Meteor.user().profile.rescueCardDescription == true) {
|
if (ReactiveCache.getCurrentUser().profile.rescueCardDescription == true) {
|
||||||
currentDescription = document.getElementsByClassName("editor js-new-description-input").item(0)
|
currentDescription = document.getElementsByClassName("editor js-new-description-input").item(0)
|
||||||
if (currentDescription?.value && !(currentDescription.value === Utils.getCurrentCard().getDescription())) {
|
if (currentDescription?.value && !(currentDescription.value === Utils.getCurrentCard().getDescription())) {
|
||||||
if (confirm(TAPi18n.__('rescue-card-description-dialogue'))) {
|
if (confirm(TAPi18n.__('rescue-card-description-dialogue'))) {
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ BlazeComponent.extendComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
function userIsMember() {
|
function userIsMember() {
|
||||||
return Meteor.user() && Meteor.user().isBoardMember();
|
return ReactiveCache.getCurrentUser()?.isBoardMember();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable sorting if the current user is not a board member
|
// Disable sorting if the current user is not a board member
|
||||||
|
|
@ -237,7 +237,7 @@ BlazeComponent.extendComponent({
|
||||||
{
|
{
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
_id: { $ne: Meteor.user().getTemplatesBoardId() },
|
_id: { $ne: ReactiveCache.getCurrentUser().getTemplatesBoardId() },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: { sort: 1 /* boards default sorting */ },
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
|
|
@ -274,7 +274,7 @@ Template.checklists.helpers({
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
hideCheckedItems() {
|
hideCheckedItems() {
|
||||||
const currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) return currentUser.hasHideCheckedItems();
|
if (currentUser) return currentUser.hasHideCheckedItems();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
@ -338,7 +338,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.checklistItemDetail.helpers({
|
Template.checklistItemDetail.helpers({
|
||||||
hideCheckedItems() {
|
hideCheckedItems() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
if (user) return user.hasHideCheckedItems();
|
if (user) return user.hasHideCheckedItems();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
@ -364,11 +364,11 @@ BlazeComponent.extendComponent({
|
||||||
/** Move Checklist Dialog */
|
/** Move Checklist Dialog */
|
||||||
(class extends DialogWithBoardSwimlaneListCard {
|
(class extends DialogWithBoardSwimlaneListCard {
|
||||||
getDialogOptions() {
|
getDialogOptions() {
|
||||||
const ret = Meteor.user().getMoveChecklistDialogOptions();
|
const ret = ReactiveCache.getCurrentUser().getMoveChecklistDialogOptions();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
setDone(cardId, options) {
|
setDone(cardId, options) {
|
||||||
Meteor.user().setMoveChecklistDialogOption(this.currentBoardId, options);
|
ReactiveCache.getCurrentUser().setMoveChecklistDialogOption(this.currentBoardId, options);
|
||||||
this.data().checklist.move(cardId);
|
this.data().checklist.move(cardId);
|
||||||
}
|
}
|
||||||
}).register('moveChecklistPopup');
|
}).register('moveChecklistPopup');
|
||||||
|
|
@ -376,11 +376,11 @@ BlazeComponent.extendComponent({
|
||||||
/** Copy Checklist Dialog */
|
/** Copy Checklist Dialog */
|
||||||
(class extends DialogWithBoardSwimlaneListCard {
|
(class extends DialogWithBoardSwimlaneListCard {
|
||||||
getDialogOptions() {
|
getDialogOptions() {
|
||||||
const ret = Meteor.user().getCopyChecklistDialogOptions();
|
const ret = ReactiveCache.getCurrentUser().getCopyChecklistDialogOptions();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
setDone(cardId, options) {
|
setDone(cardId, options) {
|
||||||
Meteor.user().setCopyChecklistDialogOption(this.currentBoardId, options);
|
ReactiveCache.getCurrentUser().setCopyChecklistDialogOption(this.currentBoardId, options);
|
||||||
this.data().checklist.copy(cardId);
|
this.data().checklist.copy(cardId);
|
||||||
}
|
}
|
||||||
}).register('copyChecklistPopup');
|
}).register('copyChecklistPopup');
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
import { CustomFieldStringTemplate } from '/client/lib/customFields'
|
import { CustomFieldStringTemplate } from '/client/lib/customFields'
|
||||||
|
|
||||||
|
|
@ -113,7 +114,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.minicard.helpers({
|
Template.minicard.helpers({
|
||||||
hiddenMinicardLabelText() {
|
hiddenMinicardLabelText() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).hiddenMinicardLabelText;
|
return (currentUser.profile || {}).hiddenMinicardLabelText;
|
||||||
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,6 @@ BlazeComponent.extendComponent({
|
||||||
onRendered() {
|
onRendered() {
|
||||||
const boardComponent = this.parentComponent().parentComponent();
|
const boardComponent = this.parentComponent().parentComponent();
|
||||||
|
|
||||||
function userIsMember() {
|
|
||||||
return (
|
|
||||||
Meteor.user() &&
|
|
||||||
Meteor.user().isBoardMember() &&
|
|
||||||
!Meteor.user().isCommentOnly()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const itemsSelector = '.js-minicard:not(.placeholder, .js-card-composer)';
|
const itemsSelector = '.js-minicard:not(.placeholder, .js-card-composer)';
|
||||||
const $cards = this.$('.js-minicards');
|
const $cards = this.$('.js-minicards');
|
||||||
|
|
||||||
|
|
@ -170,9 +162,9 @@ BlazeComponent.extendComponent({
|
||||||
'option',
|
'option',
|
||||||
'disabled',
|
'disabled',
|
||||||
// Disable drag-dropping when user is not member
|
// Disable drag-dropping when user is not member
|
||||||
!userIsMember(),
|
!Utils.canModifyBoard(),
|
||||||
// Not disable drag-dropping while in multi-selection mode
|
// Not disable drag-dropping while in multi-selection mode
|
||||||
// MultiSelection.isActive() || !userIsMember(),
|
// MultiSelection.isActive() || !Utils.canModifyBoard(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -216,10 +216,7 @@ BlazeComponent.extendComponent({
|
||||||
canSeeAddCard() {
|
canSeeAddCard() {
|
||||||
return (
|
return (
|
||||||
!this.reachedWipLimit() &&
|
!this.reachedWipLimit() &&
|
||||||
Meteor.user() &&
|
Utils.canModifyCard()
|
||||||
Meteor.user().isBoardMember() &&
|
|
||||||
!Meteor.user().isCommentOnly() &&
|
|
||||||
!Meteor.user().isWorker()
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -620,7 +617,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
this.board = {};
|
this.board = {};
|
||||||
if (this.isTemplateSearch) {
|
if (this.isTemplateSearch) {
|
||||||
const boardId = (Meteor.user().profile || {}).templatesBoardId;
|
const boardId = (ReactiveCache.getCurrentUser().profile || {}).templatesBoardId;
|
||||||
if (boardId) {
|
if (boardId) {
|
||||||
this.board = ReactiveCache.getBoard(boardId);
|
this.board = ReactiveCache.getBoard(boardId);
|
||||||
}
|
}
|
||||||
|
|
@ -789,7 +786,7 @@ BlazeComponent.extendComponent({
|
||||||
Meteor.settings.public.sandstorm;
|
Meteor.settings.public.sandstorm;
|
||||||
|
|
||||||
if (isSandstorm) {
|
if (isSandstorm) {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
if (user) {
|
if (user) {
|
||||||
if (Utils.boardView() === 'board-view-swimlanes') {
|
if (Utils.boardView() === 'board-view-swimlanes') {
|
||||||
this.swimlaneId = this.parentComponent()
|
this.swimlaneId = this.parentComponent()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
|
|
||||||
let listsColors;
|
let listsColors;
|
||||||
|
|
@ -12,12 +13,12 @@ BlazeComponent.extendComponent({
|
||||||
(!list.getWipLimit('enabled') ||
|
(!list.getWipLimit('enabled') ||
|
||||||
list.getWipLimit('soft') ||
|
list.getWipLimit('soft') ||
|
||||||
!this.reachedWipLimit()) &&
|
!this.reachedWipLimit()) &&
|
||||||
!Meteor.user().isWorker()
|
!ReactiveCache.getCurrentUser().isWorker()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
starred(check = undefined) {
|
starred(check = undefined) {
|
||||||
const list = Template.currentData();
|
const list = Template.currentData();
|
||||||
|
|
@ -47,9 +48,9 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
limitToShowCardsCount() {
|
limitToShowCardsCount() {
|
||||||
const currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return Meteor.user().getLimitToShowCardsCount();
|
return currentUser.getLimitToShowCardsCount();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -123,13 +124,13 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.listHeader.helpers({
|
Template.listHeader.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.listActionPopup.helpers({
|
Template.listActionPopup.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
|
|
||||||
isWipLimitEnabled() {
|
isWipLimitEnabled() {
|
||||||
|
|
@ -279,7 +280,7 @@ Template.listMorePopup.events({
|
||||||
|
|
||||||
Template.listHeader.helpers({
|
Template.listHeader.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { CardSearchPagedComponent } from '../../lib/cardSearch';
|
import { CardSearchPagedComponent } from '../../lib/cardSearch';
|
||||||
import {
|
import {
|
||||||
OPERATOR_HAS,
|
OPERATOR_HAS,
|
||||||
|
|
@ -66,7 +67,7 @@ class DueCardsComponent extends CardSearchPagedComponent {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Utils.dueCardsView() !== 'all') {
|
if (Utils.dueCardsView() !== 'all') {
|
||||||
queryParams.addPredicate(OPERATOR_USER, Meteor.user().username);
|
queryParams.addPredicate(OPERATOR_USER, ReactiveCache.getCurrentUser().username);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runGlobalSearch(queryParams);
|
this.runGlobalSearch(queryParams);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ Template.userFormsLayout.onCreated(function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!Meteor.user()?.profile) {
|
if (!ReactiveCache.getCurrentUser()?.profile) {
|
||||||
Meteor.call('isOidcRedirectionEnabled', (_, result) => {
|
Meteor.call('isOidcRedirectionEnabled', (_, result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
AccountsTemplates.options.socialLoginStyle = 'redirect';
|
AccountsTemplates.options.socialLoginStyle = 'redirect';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
|
|
||||||
Template.notification.events({
|
Template.notification.events({
|
||||||
'click .read-status .materialCheckBox'() {
|
'click .read-status .materialCheckBox'() {
|
||||||
const update = {};
|
const update = {};
|
||||||
|
|
@ -7,7 +9,7 @@ Template.notification.events({
|
||||||
Users.update(Meteor.userId(), { $set: update });
|
Users.update(Meteor.userId(), { $set: update });
|
||||||
},
|
},
|
||||||
'click .remove a'() {
|
'click .remove a'() {
|
||||||
Meteor.user().removeNotification(this.activityData._id);
|
ReactiveCache.getCurrentUser().removeNotification(this.activityData._id);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ Template.notificationsDrawer.helpers({
|
||||||
},
|
},
|
||||||
readNotifications() {
|
readNotifications() {
|
||||||
const readNotifications = _.filter(
|
const readNotifications = _.filter(
|
||||||
Meteor.user().profile.notifications,
|
ReactiveCache.getCurrentUser().profile.notifications,
|
||||||
v => !!v.read,
|
v => !!v.read,
|
||||||
);
|
);
|
||||||
return readNotifications.length;
|
return readNotifications.length;
|
||||||
|
|
@ -28,7 +28,7 @@ Template.notificationsDrawer.helpers({
|
||||||
|
|
||||||
Template.notificationsDrawer.events({
|
Template.notificationsDrawer.events({
|
||||||
'click .all-read'() {
|
'click .all-read'() {
|
||||||
const notifications = Meteor.user().profile.notifications;
|
const notifications = ReactiveCache.getCurrentUser().profile.notifications;
|
||||||
for (const index in notifications) {
|
for (const index in notifications) {
|
||||||
if (notifications.hasOwnProperty(index) && !notifications[index].read) {
|
if (notifications.hasOwnProperty(index) && !notifications[index].read) {
|
||||||
const update = {};
|
const update = {};
|
||||||
|
|
@ -44,7 +44,7 @@ Template.notificationsDrawer.events({
|
||||||
Session.set('showReadNotifications', !Session.get('showReadNotifications'));
|
Session.set('showReadNotifications', !Session.get('showReadNotifications'));
|
||||||
},
|
},
|
||||||
'click .remove-read'() {
|
'click .remove-read'() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
for (const notification of user.profile.notifications) {
|
for (const notification of user.profile.notifications) {
|
||||||
if (notification.read) {
|
if (notification.read) {
|
||||||
user.removeNotification(notification.activity);
|
user.removeNotification(notification.activity);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {},
|
onCreated() {},
|
||||||
|
|
||||||
|
|
@ -7,7 +9,7 @@ BlazeComponent.extendComponent({
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
_id: {
|
_id: {
|
||||||
$ne: Meteor.user().getTemplatesBoardId(),
|
$ne: ReactiveCache.getCurrentUser().getTemplatesBoardId(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ BlazeComponent.extendComponent({
|
||||||
'click .js-toggle-sidebar': this.toggle,
|
'click .js-toggle-sidebar': this.toggle,
|
||||||
'click .js-back-home': this.setView,
|
'click .js-back-home': this.setView,
|
||||||
'click .js-toggle-minicard-label-text'() {
|
'click .js-toggle-minicard-label-text'() {
|
||||||
currentUser = Meteor.user();
|
currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
Meteor.call('toggleMinicardLabelText');
|
Meteor.call('toggleMinicardLabelText');
|
||||||
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
||||||
|
|
@ -138,7 +138,7 @@ Blaze.registerHelper('Sidebar', () => Sidebar);
|
||||||
|
|
||||||
Template.homeSidebar.helpers({
|
Template.homeSidebar.helpers({
|
||||||
hiddenMinicardLabelText() {
|
hiddenMinicardLabelText() {
|
||||||
currentUser = Meteor.user();
|
currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).hiddenMinicardLabelText;
|
return (currentUser.profile || {}).hiddenMinicardLabelText;
|
||||||
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
||||||
|
|
@ -173,7 +173,7 @@ Template.memberPopup.helpers({
|
||||||
return ReactiveCache.getUser(this.userId);
|
return ReactiveCache.getUser(this.userId);
|
||||||
},
|
},
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
memberType() {
|
memberType() {
|
||||||
const type = ReactiveCache.getUser(this.userId).isBoardAdmin() ? 'admin' : 'normal';
|
const type = ReactiveCache.getUser(this.userId).isBoardAdmin() ? 'admin' : 'normal';
|
||||||
|
|
@ -249,7 +249,7 @@ Template.boardMenuPopup.onCreated(function() {
|
||||||
|
|
||||||
Template.boardMenuPopup.helpers({
|
Template.boardMenuPopup.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
withApi() {
|
withApi() {
|
||||||
return Template.instance().apiEnabled.get();
|
return Template.instance().apiEnabled.get();
|
||||||
|
|
@ -359,11 +359,11 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.membersWidget.helpers({
|
Template.membersWidget.helpers({
|
||||||
isInvited() {
|
isInvited() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
return user && user.isInvitedTo(Session.get('currentBoard'));
|
return user && user.isInvitedTo(Session.get('currentBoard'));
|
||||||
},
|
},
|
||||||
isWorker() {
|
isWorker() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
if (user) {
|
if (user) {
|
||||||
return Meteor.call(Boards.hasWorker(user.memberId));
|
return Meteor.call(Boards.hasWorker(user.memberId));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -371,7 +371,7 @@ Template.membersWidget.helpers({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
AtLeastOneOrgWasCreated(){
|
AtLeastOneOrgWasCreated(){
|
||||||
let orgs = Org.find({}, {sort: { createdAt: -1 }});
|
let orgs = Org.find({}, {sort: { createdAt: -1 }});
|
||||||
|
|
@ -407,13 +407,13 @@ Template.membersWidget.events({
|
||||||
},
|
},
|
||||||
'click .js-member-invite-accept'() {
|
'click .js-member-invite-accept'() {
|
||||||
const boardId = Session.get('currentBoard');
|
const boardId = Session.get('currentBoard');
|
||||||
Meteor.user().removeInvite(boardId);
|
ReactiveCache.getCurrentUser().removeInvite(boardId);
|
||||||
},
|
},
|
||||||
'click .js-member-invite-decline'() {
|
'click .js-member-invite-decline'() {
|
||||||
const boardId = Session.get('currentBoard');
|
const boardId = Session.get('currentBoard');
|
||||||
Meteor.call('quitBoard', boardId, (err, ret) => {
|
Meteor.call('quitBoard', boardId, (err, ret) => {
|
||||||
if (!err && ret) {
|
if (!err && ret) {
|
||||||
Meteor.user().removeInvite(boardId);
|
ReactiveCache.getCurrentUser().removeInvite(boardId);
|
||||||
FlowRouter.go('home');
|
FlowRouter.go('home');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -605,7 +605,7 @@ Template.labelsWidget.events({
|
||||||
|
|
||||||
Template.labelsWidget.helpers({
|
Template.labelsWidget.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -640,7 +640,7 @@ function draggableMembersLabelsWidgets() {
|
||||||
});
|
});
|
||||||
|
|
||||||
function userIsMember() {
|
function userIsMember() {
|
||||||
return Meteor.user() && Meteor.user().isBoardMember();
|
return ReactiveCache.getCurrentUser()?.isBoardMember();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.autorun(() => {
|
this.autorun(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
|
|
||||||
//archivedRequested = false;
|
//archivedRequested = false;
|
||||||
|
|
@ -159,7 +160,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.archivesSidebar.helpers({
|
Template.archivesSidebar.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
isWorker() {
|
isWorker() {
|
||||||
const currentBoard = Utils.getCurrentBoard();
|
const currentBoard = Utils.getCurrentBoard();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
|
|
||||||
const subManager = new SubsManager();
|
const subManager = new SubsManager();
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
|
|
@ -171,10 +173,10 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.multiselectionSidebar.helpers({
|
Template.multiselectionSidebar.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
isCommentOnly() {
|
isCommentOnly() {
|
||||||
return Meteor.user().isCommentOnly();
|
return ReactiveCache.getCurrentUser().isCommentOnly();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
const { calculateIndexData } = Utils;
|
const { calculateIndexData } = Utils;
|
||||||
|
|
||||||
let swimlaneColors;
|
let swimlaneColors;
|
||||||
|
|
@ -30,7 +31,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.swimlaneFixedHeader.helpers({
|
Template.swimlaneFixedHeader.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -47,7 +48,7 @@ Template.swimlaneActionPopup.events({
|
||||||
|
|
||||||
Template.swimlaneActionPopup.events({
|
Template.swimlaneActionPopup.events({
|
||||||
isCommentOnly() {
|
isCommentOnly() {
|
||||||
return Meteor.user().isCommentOnly();
|
return ReactiveCache.getCurrentUser().isCommentOnly();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
const { calculateIndex } = Utils;
|
const { calculateIndex } = Utils;
|
||||||
|
|
||||||
function currentListIsInThisSwimlane(swimlaneId) {
|
function currentListIsInThisSwimlane(swimlaneId) {
|
||||||
|
|
@ -10,7 +11,7 @@ function currentListIsInThisSwimlane(swimlaneId) {
|
||||||
|
|
||||||
function currentCardIsInThisList(listId, swimlaneId) {
|
function currentCardIsInThisList(listId, swimlaneId) {
|
||||||
const currentCard = Utils.getCurrentCard();
|
const currentCard = Utils.getCurrentCard();
|
||||||
//const currentUser = Meteor.user();
|
//const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (
|
if (
|
||||||
//currentUser &&
|
//currentUser &&
|
||||||
//currentUser.profile &&
|
//currentUser.profile &&
|
||||||
|
|
@ -104,15 +105,6 @@ function initSortable(boardComponent, $listsDom) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
//function userIsMember() {
|
|
||||||
// return (
|
|
||||||
// Meteor.user() &&
|
|
||||||
// Meteor.user().isBoardMember() &&
|
|
||||||
// !Meteor.user().isCommentOnly() &&
|
|
||||||
// !Meteor.user().isWorker()
|
|
||||||
// );
|
|
||||||
//}
|
|
||||||
|
|
||||||
boardComponent.autorun(() => {
|
boardComponent.autorun(() => {
|
||||||
if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
|
if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
|
||||||
$listsDom.sortable({
|
$listsDom.sortable({
|
||||||
|
|
@ -129,11 +121,7 @@ function initSortable(boardComponent, $listsDom) {
|
||||||
$listsDom.sortable(
|
$listsDom.sortable(
|
||||||
'option',
|
'option',
|
||||||
'disabled',
|
'disabled',
|
||||||
// Disable drag-dropping when user is not member/is worker
|
!ReactiveCache.getCurrentUser()?.isBoardAdmin(),
|
||||||
//!userIsMember() || Meteor.user().isWorker(),
|
|
||||||
!Meteor.user() || !Meteor.user().isBoardAdmin(),
|
|
||||||
// Not disable drag-dropping while in multi-selection mode
|
|
||||||
// MultiSelection.isActive() || !userIsMember(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -294,12 +282,6 @@ BlazeComponent.extendComponent({
|
||||||
Template.swimlane.helpers({
|
Template.swimlane.helpers({
|
||||||
canSeeAddList() {
|
canSeeAddList() {
|
||||||
return Meteor.user().isBoardAdmin();
|
return Meteor.user().isBoardAdmin();
|
||||||
/*
|
|
||||||
Meteor.user() &&
|
|
||||||
Meteor.user().isBoardMember() &&
|
|
||||||
!Meteor.user().isCommentOnly() &&
|
|
||||||
!Meteor.user().isWorker()
|
|
||||||
*/
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,6 @@ Template.boardOrgRow.helpers({
|
||||||
orgData() {
|
orgData() {
|
||||||
return Org.findOne(this.orgId);
|
return Org.findOne(this.orgId);
|
||||||
},
|
},
|
||||||
currentUser(){
|
|
||||||
return Meteor.user();
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.boardOrgName.helpers({
|
Template.boardOrgName.helpers({
|
||||||
|
|
@ -153,9 +150,6 @@ Template.boardTeamRow.helpers({
|
||||||
teamData() {
|
teamData() {
|
||||||
return Team.findOne(this.teamId);
|
return Team.findOne(this.teamId);
|
||||||
},
|
},
|
||||||
currentUser(){
|
|
||||||
return Meteor.user();
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.boardTeamName.helpers({
|
Template.boardTeamName.helpers({
|
||||||
|
|
@ -182,20 +176,20 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isSelected() {
|
isSelected() {
|
||||||
const userProfile = Meteor.user().profile;
|
const userProfile = ReactiveCache.getCurrentUser().profile;
|
||||||
const avatarUrl = userProfile && userProfile.avatarUrl;
|
const avatarUrl = userProfile && userProfile.avatarUrl;
|
||||||
const currentAvatarUrl = `${this.currentData().link()}?auth=false&brokenIsFine=true`;
|
const currentAvatarUrl = `${this.currentData().link()}?auth=false&brokenIsFine=true`;
|
||||||
return avatarUrl === currentAvatarUrl;
|
return avatarUrl === currentAvatarUrl;
|
||||||
},
|
},
|
||||||
|
|
||||||
noAvatarUrl() {
|
noAvatarUrl() {
|
||||||
const userProfile = Meteor.user().profile;
|
const userProfile = ReactiveCache.getCurrentUser().profile;
|
||||||
const avatarUrl = userProfile && userProfile.avatarUrl;
|
const avatarUrl = userProfile && userProfile.avatarUrl;
|
||||||
return !avatarUrl;
|
return !avatarUrl;
|
||||||
},
|
},
|
||||||
|
|
||||||
setAvatar(avatarUrl) {
|
setAvatar(avatarUrl) {
|
||||||
Meteor.user().setAvatarUrl(avatarUrl);
|
ReactiveCache.getCurrentUser().setAvatarUrl(avatarUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
setError(error) {
|
setError(error) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
|
|
||||||
Template.headerUserBar.events({
|
Template.headerUserBar.events({
|
||||||
|
|
@ -13,18 +14,18 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.memberMenuPopup.helpers({
|
Template.memberMenuPopup.helpers({
|
||||||
templatesBoardId() {
|
templatesBoardId() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return Meteor.user().getTemplatesBoardId();
|
return currentUser.getTemplatesBoardId();
|
||||||
} else {
|
} else {
|
||||||
// No need to getTemplatesBoardId on public board
|
// No need to getTemplatesBoardId on public board
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
templatesBoardSlug() {
|
templatesBoardSlug() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return Meteor.user().getTemplatesBoardSlug();
|
return currentUser.getTemplatesBoardSlug();
|
||||||
} else {
|
} else {
|
||||||
// No need to getTemplatesBoardSlug() on public board
|
// No need to getTemplatesBoardSlug() on public board
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -33,7 +34,7 @@ Template.memberMenuPopup.helpers({
|
||||||
isSameDomainNameSettingValue(){
|
isSameDomainNameSettingValue(){
|
||||||
const currSett = Utils.getCurrentSetting();
|
const currSett = Utils.getCurrentSetting();
|
||||||
if(currSett && currSett != undefined && currSett.disableRegistration && currSett.mailDomainName !== undefined && currSett.mailDomainName != ""){
|
if(currSett && currSett != undefined && currSett.disableRegistration && currSett.mailDomainName !== undefined && currSett.mailDomainName != ""){
|
||||||
currentUser = Meteor.user();
|
currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
let found = false;
|
let found = false;
|
||||||
for(let i = 0; i < currentUser.emails.length; i++) {
|
for(let i = 0; i < currentUser.emails.length; i++) {
|
||||||
|
|
@ -51,7 +52,7 @@ Template.memberMenuPopup.helpers({
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isNotOAuth2AuthenticationMethod(){
|
isNotOAuth2AuthenticationMethod(){
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return currentUser.authenticationMethod.toLowerCase() != 'oauth2';
|
return currentUser.authenticationMethod.toLowerCase() != 'oauth2';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -185,9 +186,9 @@ Template.editProfilePopup.events({
|
||||||
'profile.initials': initials,
|
'profile.initials': initials,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
isChangeUserName = username !== Meteor.user().username;
|
isChangeUserName = username !== ReactiveCache.getCurrentUser().username;
|
||||||
isChangeEmail =
|
isChangeEmail =
|
||||||
email.toLowerCase() !== Meteor.user().emails[0].address.toLowerCase();
|
email.toLowerCase() !== ReactiveCache.getCurrentUser().emails[0].address.toLowerCase();
|
||||||
if (isChangeUserName && isChangeEmail) {
|
if (isChangeUserName && isChangeEmail) {
|
||||||
Meteor.call(
|
Meteor.call(
|
||||||
'setUsernameAndEmail',
|
'setUsernameAndEmail',
|
||||||
|
|
@ -282,7 +283,7 @@ Template.changeLanguagePopup.events({
|
||||||
|
|
||||||
Template.changeSettingsPopup.helpers({
|
Template.changeSettingsPopup.helpers({
|
||||||
hiddenSystemMessages() {
|
hiddenSystemMessages() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).hasHiddenSystemMessages;
|
return (currentUser.profile || {}).hasHiddenSystemMessages;
|
||||||
} else if (window.localStorage.getItem('hasHiddenSystemMessages')) {
|
} else if (window.localStorage.getItem('hasHiddenSystemMessages')) {
|
||||||
|
|
@ -292,7 +293,7 @@ Template.changeSettingsPopup.helpers({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rescueCardDescription() {
|
rescueCardDescription() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).rescueCardDescription;
|
return (currentUser.profile || {}).rescueCardDescription;
|
||||||
} else if (window.localStorage.getItem('rescueCardDescription')) {
|
} else if (window.localStorage.getItem('rescueCardDescription')) {
|
||||||
|
|
@ -302,9 +303,9 @@ Template.changeSettingsPopup.helpers({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showCardsCountAt() {
|
showCardsCountAt() {
|
||||||
currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return Meteor.user().getLimitToShowCardsCount();
|
return currentUser.getLimitToShowCardsCount();
|
||||||
} else {
|
} else {
|
||||||
return window.localStorage.getItem('limitToShowCardsCount');
|
return window.localStorage.getItem('limitToShowCardsCount');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,11 @@ Blaze.registerHelper('currentSetting', () => {
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Blaze.registerHelper('currentUser', () => {
|
||||||
|
const ret = ReactiveCache.getCurrentUser();
|
||||||
|
return ret;
|
||||||
|
});
|
||||||
|
|
||||||
Blaze.registerHelper('getUser', userId => ReactiveCache.getUser(userId));
|
Blaze.registerHelper('getUser', userId => ReactiveCache.getUser(userId));
|
||||||
|
|
||||||
Blaze.registerHelper('concat', (...args) => args.slice(0, -1).join(''));
|
Blaze.registerHelper('concat', (...args) => args.slice(0, -1).join(''));
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
import moment from 'moment/min/moment-with-locales';
|
import moment from 'moment/min/moment-with-locales';
|
||||||
|
|
||||||
|
|
@ -22,7 +23,7 @@ export class DatePicker extends BlazeComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
startDayOfWeek() {
|
startDayOfWeek() {
|
||||||
const currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return currentUser.getStartDayOfWeek();
|
return currentUser.getStartDayOfWeek();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ export class DialogWithBoardSwimlaneList extends BlazeComponent {
|
||||||
{
|
{
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
_id: { $ne: Meteor.user().getTemplatesBoardId() },
|
_id: { $ne: ReactiveCache.getCurrentUser().getTemplatesBoardId() },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: { sort: 1 },
|
sort: { sort: 1 },
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import moment from 'moment/min/moment-with-locales';
|
import moment from 'moment/min/moment-with-locales';
|
||||||
|
|
||||||
// Filtered view manager
|
// Filtered view manager
|
||||||
|
|
@ -107,7 +108,7 @@ class DateFilter {
|
||||||
// preferred starting day of the week. This date should be added
|
// preferred starting day of the week. This date should be added
|
||||||
// to the moment start of week to get the real start of week date.
|
// to the moment start of week to get the real start of week date.
|
||||||
// The default is 1, meaning Monday.
|
// The default is 1, meaning Monday.
|
||||||
const currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
const weekStartDay = currentUser ? currentUser.getStartDayOfWeek() : 1;
|
const weekStartDay = currentUser ? currentUser.getStartDayOfWeek() : 1;
|
||||||
|
|
||||||
if (week === 'this') {
|
if (week === 'this') {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
|
|
||||||
// We save the user language preference in the user profile, and use that to set
|
// We save the user language preference in the user profile, and use that to set
|
||||||
|
|
@ -5,7 +6,7 @@ import { TAPi18n } from '/imports/i18n';
|
||||||
// information provided by the browser, and default to english.
|
// information provided by the browser, and default to english.
|
||||||
|
|
||||||
Meteor.startup(async () => {
|
Meteor.startup(async () => {
|
||||||
let currentUser = Meteor.user();
|
let currentUser = ReactiveCache.getCurrentUser();
|
||||||
// If we're still logging in, wait (#4967)
|
// If we're still logging in, wait (#4967)
|
||||||
if (!currentUser && Meteor.loggingIn()) {
|
if (!currentUser && Meteor.loggingIn()) {
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
|
|
@ -15,7 +16,7 @@ Meteor.startup(async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
currentUser = Meteor.user();
|
currentUser = ReactiveCache.getCurrentUser();
|
||||||
}
|
}
|
||||||
// Select first available language
|
// Select first available language
|
||||||
const [language] = [
|
const [language] = [
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ Mousetrap.bind(numArray, (evt, key) => {
|
||||||
}
|
}
|
||||||
board = ReactiveCache.getBoard(currentBoardId);
|
board = ReactiveCache.getBoard(currentBoardId);
|
||||||
labels = board.labels;
|
labels = board.labels;
|
||||||
if(MultiSelection.isActive() && Meteor.user().isBoardMember())
|
if(MultiSelection.isActive() && ReactiveCache.getCurrentUser().isBoardMember())
|
||||||
{
|
{
|
||||||
const cardIds = MultiSelection.getSelectedCardIds();
|
const cardIds = MultiSelection.getSelectedCardIds();
|
||||||
for (const cardId of cardIds)
|
for (const cardId of cardIds)
|
||||||
|
|
@ -122,7 +122,7 @@ Mousetrap.bind(numArray, (evt, key) => {
|
||||||
if (!cardId) {
|
if (!cardId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Meteor.user().isBoardMember()) {
|
if (ReactiveCache.getCurrentUser().isBoardMember()) {
|
||||||
const card = ReactiveCache.getCard(cardId);
|
const card = ReactiveCache.getCard(cardId);
|
||||||
if(num <= board.labels.length)
|
if(num <= board.labels.length)
|
||||||
{
|
{
|
||||||
|
|
@ -142,7 +142,7 @@ Mousetrap.bind('space', evt => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Meteor.user().isBoardMember()) {
|
if (ReactiveCache.getCurrentUser().isBoardMember()) {
|
||||||
const card = ReactiveCache.getCard(cardId);
|
const card = ReactiveCache.getCard(cardId);
|
||||||
card.toggleMember(currentUserId);
|
card.toggleMember(currentUserId);
|
||||||
// We should prevent scrolling in card when spacebar is clicked
|
// We should prevent scrolling in card when spacebar is clicked
|
||||||
|
|
@ -162,11 +162,7 @@ Mousetrap.bind('c', evt => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (Utils.canModifyBoard()) {
|
||||||
Meteor.user().isBoardMember() &&
|
|
||||||
!Meteor.user().isCommentOnly() &&
|
|
||||||
!Meteor.user().isWorker()
|
|
||||||
) {
|
|
||||||
const card = ReactiveCache.getCard(cardId);
|
const card = ReactiveCache.getCard(cardId);
|
||||||
card.archive();
|
card.archive();
|
||||||
// We should prevent scrolling in card when spacebar is clicked
|
// We should prevent scrolling in card when spacebar is clicked
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ Utils = {
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
canModifyCard() {
|
canModifyCard() {
|
||||||
const currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
const ret = (
|
const ret = (
|
||||||
currentUser &&
|
currentUser &&
|
||||||
currentUser.isBoardMember() &&
|
currentUser.isBoardMember() &&
|
||||||
|
|
@ -78,7 +78,7 @@ Utils = {
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
canModifyBoard() {
|
canModifyBoard() {
|
||||||
const currentUser = Meteor.user();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
const ret = (
|
const ret = (
|
||||||
currentUser &&
|
currentUser &&
|
||||||
currentUser.isBoardMember() &&
|
currentUser.isBoardMember() &&
|
||||||
|
|
@ -94,9 +94,9 @@ Utils = {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
},
|
},
|
||||||
setBoardView(view) {
|
setBoardView(view) {
|
||||||
currentUser = Meteor.user();
|
currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
Meteor.user().setBoardView(view);
|
ReactiveCache.getCurrentUser().setBoardView(view);
|
||||||
} else if (view === 'board-view-swimlanes') {
|
} else if (view === 'board-view-swimlanes') {
|
||||||
window.localStorage.setItem('boardView', 'board-view-swimlanes'); //true
|
window.localStorage.setItem('boardView', 'board-view-swimlanes'); //true
|
||||||
Utils.reload();
|
Utils.reload();
|
||||||
|
|
@ -118,7 +118,7 @@ Utils = {
|
||||||
},
|
},
|
||||||
|
|
||||||
boardView() {
|
boardView() {
|
||||||
currentUser = Meteor.user();
|
currentUser = ReactiveCache.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return (currentUser.profile || {}).boardView;
|
return (currentUser.profile || {}).boardView;
|
||||||
} else if (
|
} else if (
|
||||||
|
|
@ -334,7 +334,7 @@ Utils = {
|
||||||
|
|
||||||
// returns if desktop drag handles are enabled
|
// returns if desktop drag handles are enabled
|
||||||
isShowDesktopDragHandles() {
|
isShowDesktopDragHandles() {
|
||||||
//const currentUser = Meteor.user();
|
//const currentUser = ReactiveCache.getCurrentUser();
|
||||||
//if (currentUser) {
|
//if (currentUser) {
|
||||||
// return (currentUser.profile || {}).showDesktopDragHandles;
|
// return (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
//} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
//} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||||
|
|
@ -451,7 +451,7 @@ Utils = {
|
||||||
window._paq = window._paq || [];
|
window._paq = window._paq || [];
|
||||||
window._paq.push(['setDoNotTrack', data.doNotTrack]);
|
window._paq.push(['setDoNotTrack', data.doNotTrack]);
|
||||||
if (data.withUserName) {
|
if (data.withUserName) {
|
||||||
window._paq.push(['setUserId', Meteor.user().username]);
|
window._paq.push(['setUserId', ReactiveCache.getCurrentUser().username]);
|
||||||
}
|
}
|
||||||
window._paq.push(['trackPageView']);
|
window._paq.push(['trackPageView']);
|
||||||
window._paq.push(['enableLinkTracking']);
|
window._paq.push(['enableLinkTracking']);
|
||||||
|
|
|
||||||
|
|
@ -739,17 +739,12 @@ Boards.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
//currentUser = Meteor.user();
|
|
||||||
//if (currentUser) {
|
|
||||||
// enabled = Meteor.user().hasSortBy();
|
|
||||||
//}
|
|
||||||
//return enabled ? this.newestLists() : this.draggableLists();
|
|
||||||
return this.draggableLists();
|
return this.draggableLists();
|
||||||
},
|
},
|
||||||
|
|
||||||
newestLists() {
|
newestLists() {
|
||||||
// sorted lists from newest to the oldest, by its creation date or its cards' last modification date
|
// sorted lists from newest to the oldest, by its creation date or its cards' last modification date
|
||||||
const value = Meteor.user()._getListSortBy();
|
const value = ReactiveCache.getCurrentUser()._getListSortBy();
|
||||||
const sortKey = { starred: -1, [value[0]]: value[1] }; // [["starred",-1],value];
|
const sortKey = { starred: -1, [value[0]]: value[1] }; // [["starred",-1],value];
|
||||||
return Lists.find(
|
return Lists.find(
|
||||||
{
|
{
|
||||||
|
|
@ -1299,9 +1294,10 @@ Boards.mutations({
|
||||||
},
|
},
|
||||||
|
|
||||||
setBackgroundImageURL(backgroundImageURL) {
|
setBackgroundImageURL(backgroundImageURL) {
|
||||||
if(Meteor.user().isBoardAdmin()) {
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
|
if(currentUser.isBoardAdmin()) {
|
||||||
return { $set: { backgroundImageURL } };
|
return { $set: { backgroundImageURL } };
|
||||||
} else if (Meteor.user().isAdmin()) {
|
} else if (currentUser.isAdmin()) {
|
||||||
return { $set: { backgroundImageURL } };
|
return { $set: { backgroundImageURL } };
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ Integrations.Const = {
|
||||||
const permissionHelper = {
|
const permissionHelper = {
|
||||||
allow(userId, doc) {
|
allow(userId, doc) {
|
||||||
const user = ReactiveCache.getUser(userId);
|
const user = ReactiveCache.getUser(userId);
|
||||||
const isAdmin = user && Meteor.user().isAdmin;
|
const isAdmin = user && ReactiveCache.getCurrentUser().isAdmin;
|
||||||
return isAdmin || allowIsBoardAdmin(userId, ReactiveCache.getBoard(doc.boardId));
|
return isAdmin || allowIsBoardAdmin(userId, ReactiveCache.getBoard(doc.boardId));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ if (Meteor.isServer) {
|
||||||
orgWebsite,
|
orgWebsite,
|
||||||
orgIsActive,
|
orgIsActive,
|
||||||
) {
|
) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(orgDisplayName, String);
|
check(orgDisplayName, String);
|
||||||
check(orgDesc, String);
|
check(orgDesc, String);
|
||||||
check(orgShortName, String);
|
check(orgShortName, String);
|
||||||
|
|
@ -166,7 +166,7 @@ if (Meteor.isServer) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setOrgDisplayName(org, orgDisplayName) {
|
setOrgDisplayName(org, orgDisplayName) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(org, Object);
|
check(org, Object);
|
||||||
check(orgDisplayName, String);
|
check(orgDisplayName, String);
|
||||||
Org.update(org, {
|
Org.update(org, {
|
||||||
|
|
@ -177,7 +177,7 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
|
|
||||||
setOrgDesc(org, orgDesc) {
|
setOrgDesc(org, orgDesc) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(org, Object);
|
check(org, Object);
|
||||||
check(orgDesc, String);
|
check(orgDesc, String);
|
||||||
Org.update(org, {
|
Org.update(org, {
|
||||||
|
|
@ -187,7 +187,7 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
|
|
||||||
setOrgShortName(org, orgShortName) {
|
setOrgShortName(org, orgShortName) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(org, Object);
|
check(org, Object);
|
||||||
check(orgShortName, String);
|
check(orgShortName, String);
|
||||||
Org.update(org, {
|
Org.update(org, {
|
||||||
|
|
@ -197,7 +197,7 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
|
|
||||||
setOrgIsActive(org, orgIsActive) {
|
setOrgIsActive(org, orgIsActive) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(org, Object);
|
check(org, Object);
|
||||||
check(orgIsActive, Boolean);
|
check(orgIsActive, Boolean);
|
||||||
Org.update(org, {
|
Org.update(org, {
|
||||||
|
|
@ -238,7 +238,7 @@ if (Meteor.isServer) {
|
||||||
orgWebsite,
|
orgWebsite,
|
||||||
orgIsActive,
|
orgIsActive,
|
||||||
) {
|
) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(org, Object);
|
check(org, Object);
|
||||||
check(orgDisplayName, String);
|
check(orgDisplayName, String);
|
||||||
check(orgDesc, String);
|
check(orgDesc, String);
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@ if (Meteor.isServer) {
|
||||||
if (!Meteor.userId()) {
|
if (!Meteor.userId()) {
|
||||||
throw new Meteor.Error('invalid-user');
|
throw new Meteor.Error('invalid-user');
|
||||||
}
|
}
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
if (!user.emails || !user.emails[0] || !user.emails[0].address) {
|
if (!user.emails || !user.emails[0] || !user.emails[0].address) {
|
||||||
throw new Meteor.Error('email-invalid');
|
throw new Meteor.Error('email-invalid');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -198,11 +198,6 @@ Swimlanes.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
//currentUser = Meteor.user();
|
|
||||||
//if (currentUser) {
|
|
||||||
// enabled = Meteor.user().hasSortBy();
|
|
||||||
//}
|
|
||||||
//return enabled ? this.newestLists() : this.draggableLists();
|
|
||||||
return this.draggableLists();
|
return this.draggableLists();
|
||||||
},
|
},
|
||||||
newestLists() {
|
newestLists() {
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ if (Meteor.isServer) {
|
||||||
teamWebsite,
|
teamWebsite,
|
||||||
teamIsActive,
|
teamIsActive,
|
||||||
) {
|
) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(teamDisplayName, String);
|
check(teamDisplayName, String);
|
||||||
check(teamDesc, String);
|
check(teamDesc, String);
|
||||||
check(teamShortName, String);
|
check(teamShortName, String);
|
||||||
|
|
@ -163,7 +163,7 @@ if (Meteor.isServer) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setTeamDisplayName(team, teamDisplayName) {
|
setTeamDisplayName(team, teamDisplayName) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(team, Object);
|
check(team, Object);
|
||||||
check(teamDisplayName, String);
|
check(teamDisplayName, String);
|
||||||
Team.update(team, {
|
Team.update(team, {
|
||||||
|
|
@ -174,7 +174,7 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
|
|
||||||
setTeamDesc(team, teamDesc) {
|
setTeamDesc(team, teamDesc) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(team, Object);
|
check(team, Object);
|
||||||
check(teamDesc, String);
|
check(teamDesc, String);
|
||||||
Team.update(team, {
|
Team.update(team, {
|
||||||
|
|
@ -184,7 +184,7 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
|
|
||||||
setTeamShortName(team, teamShortName) {
|
setTeamShortName(team, teamShortName) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(team, Object);
|
check(team, Object);
|
||||||
check(teamShortName, String);
|
check(teamShortName, String);
|
||||||
Team.update(team, {
|
Team.update(team, {
|
||||||
|
|
@ -194,7 +194,7 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
|
|
||||||
setTeamIsActive(team, teamIsActive) {
|
setTeamIsActive(team, teamIsActive) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(team, Object);
|
check(team, Object);
|
||||||
check(teamIsActive, Boolean);
|
check(teamIsActive, Boolean);
|
||||||
Team.update(team, {
|
Team.update(team, {
|
||||||
|
|
@ -235,7 +235,7 @@ if (Meteor.isServer) {
|
||||||
teamWebsite,
|
teamWebsite,
|
||||||
teamIsActive,
|
teamIsActive,
|
||||||
) {
|
) {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
check(team, Object);
|
check(team, Object);
|
||||||
check(teamDisplayName, String);
|
check(teamDisplayName, String);
|
||||||
check(teamDesc, String);
|
check(teamDesc, String);
|
||||||
|
|
|
||||||
|
|
@ -503,8 +503,8 @@ Users.attachSchema(
|
||||||
|
|
||||||
Users.allow({
|
Users.allow({
|
||||||
update(userId, doc) {
|
update(userId, doc) {
|
||||||
const user = ReactiveCache.getUser(userId);
|
const user = ReactiveCache.getUser(userId) || ReactiveCache.getCurrentUser();
|
||||||
if ((user && user.isAdmin) || (Meteor.user() && Meteor.user().isAdmin))
|
if (user?.isAdmin)
|
||||||
return true;
|
return true;
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -540,7 +540,7 @@ Users.allow({
|
||||||
// Non-Admin users can not change to Admin
|
// Non-Admin users can not change to Admin
|
||||||
Users.deny({
|
Users.deny({
|
||||||
update(userId, board, fieldNames) {
|
update(userId, board, fieldNames) {
|
||||||
return _.contains(fieldNames, 'isAdmin') && !Meteor.user().isAdmin;
|
return _.contains(fieldNames, 'isAdmin') && !ReactiveCache.getCurrentUser().isAdmin;
|
||||||
},
|
},
|
||||||
fetch: [],
|
fetch: [],
|
||||||
});
|
});
|
||||||
|
|
@ -1140,50 +1140,50 @@ Users.mutations({
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
setListSortBy(value) {
|
setListSortBy(value) {
|
||||||
check(value, String);
|
check(value, String);
|
||||||
Meteor.user().setListSortBy(value);
|
ReactiveCache.getCurrentUser().setListSortBy(value);
|
||||||
},
|
},
|
||||||
toggleDesktopDragHandles() {
|
toggleDesktopDragHandles() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.toggleDesktopHandles(user.hasShowDesktopDragHandles());
|
user.toggleDesktopHandles(user.hasShowDesktopDragHandles());
|
||||||
},
|
},
|
||||||
toggleHideCheckedItems() {
|
toggleHideCheckedItems() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.toggleHideCheckedItems();
|
user.toggleHideCheckedItems();
|
||||||
},
|
},
|
||||||
toggleSystemMessages() {
|
toggleSystemMessages() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.toggleSystem(user.hasHiddenSystemMessages());
|
user.toggleSystem(user.hasHiddenSystemMessages());
|
||||||
},
|
},
|
||||||
toggleCustomFieldsGrid() {
|
toggleCustomFieldsGrid() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.toggleFieldsGrid(user.hasCustomFieldsGrid());
|
user.toggleFieldsGrid(user.hasCustomFieldsGrid());
|
||||||
},
|
},
|
||||||
toggleCardMaximized() {
|
toggleCardMaximized() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.toggleCardMaximized(user.hasCardMaximized());
|
user.toggleCardMaximized(user.hasCardMaximized());
|
||||||
},
|
},
|
||||||
toggleMinicardLabelText() {
|
toggleMinicardLabelText() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.toggleLabelText(user.hasHiddenMinicardLabelText());
|
user.toggleLabelText(user.hasHiddenMinicardLabelText());
|
||||||
},
|
},
|
||||||
toggleRescueCardDescription() {
|
toggleRescueCardDescription() {
|
||||||
const user = Meteor.user();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.toggleRescueCardDescription(user.hasRescuedCardDescription());
|
user.toggleRescueCardDescription(user.hasRescuedCardDescription());
|
||||||
},
|
},
|
||||||
changeLimitToShowCardsCount(limit) {
|
changeLimitToShowCardsCount(limit) {
|
||||||
check(limit, Number);
|
check(limit, Number);
|
||||||
Meteor.user().setShowCardsCountAt(limit);
|
ReactiveCache.getCurrentUser().setShowCardsCountAt(limit);
|
||||||
},
|
},
|
||||||
changeStartDayOfWeek(startDay) {
|
changeStartDayOfWeek(startDay) {
|
||||||
check(startDay, Number);
|
check(startDay, Number);
|
||||||
Meteor.user().setStartDayOfWeek(startDay);
|
ReactiveCache.getCurrentUser().setStartDayOfWeek(startDay);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Meteor.isServer) {
|
if (Meteor.isServer) {
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
setAllUsersHideSystemMessages() {
|
setAllUsersHideSystemMessages() {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
// If setting is missing, add it
|
// If setting is missing, add it
|
||||||
Users.update(
|
Users.update(
|
||||||
{
|
{
|
||||||
|
|
@ -1241,7 +1241,7 @@ if (Meteor.isServer) {
|
||||||
check(importUsernames, Array);
|
check(importUsernames, Array);
|
||||||
check(userOrgsArray, Array);
|
check(userOrgsArray, Array);
|
||||||
check(userTeamsArray, Array);
|
check(userTeamsArray, Array);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
const nUsersWithUsername = Users.find({
|
const nUsersWithUsername = Users.find({
|
||||||
username,
|
username,
|
||||||
}).count();
|
}).count();
|
||||||
|
|
@ -1283,7 +1283,7 @@ if (Meteor.isServer) {
|
||||||
setUsername(username, userId) {
|
setUsername(username, userId) {
|
||||||
check(username, String);
|
check(username, String);
|
||||||
check(userId, String);
|
check(userId, String);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
const nUsersWithUsername = Users.find({
|
const nUsersWithUsername = Users.find({
|
||||||
username,
|
username,
|
||||||
}).count();
|
}).count();
|
||||||
|
|
@ -1301,7 +1301,7 @@ if (Meteor.isServer) {
|
||||||
setEmail(email, userId) {
|
setEmail(email, userId) {
|
||||||
check(email, String);
|
check(email, String);
|
||||||
check(username, String);
|
check(username, String);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
if (Array.isArray(email)) {
|
if (Array.isArray(email)) {
|
||||||
email = email.shift();
|
email = email.shift();
|
||||||
}
|
}
|
||||||
|
|
@ -1335,7 +1335,7 @@ if (Meteor.isServer) {
|
||||||
check(username, String);
|
check(username, String);
|
||||||
check(email, String);
|
check(email, String);
|
||||||
check(userId, String);
|
check(userId, String);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
if (Array.isArray(email)) {
|
if (Array.isArray(email)) {
|
||||||
email = email.shift();
|
email = email.shift();
|
||||||
}
|
}
|
||||||
|
|
@ -1346,17 +1346,15 @@ if (Meteor.isServer) {
|
||||||
setPassword(newPassword, userId) {
|
setPassword(newPassword, userId) {
|
||||||
check(userId, String);
|
check(userId, String);
|
||||||
check(newPassword, String);
|
check(newPassword, String);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
if (Meteor.user().isAdmin) {
|
Accounts.setPassword(userId, newPassword);
|
||||||
Accounts.setPassword(userId, newPassword);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setEmailVerified(email, verified, userId) {
|
setEmailVerified(email, verified, userId) {
|
||||||
check(email, String);
|
check(email, String);
|
||||||
check(verified, Boolean);
|
check(verified, Boolean);
|
||||||
check(userId, String);
|
check(userId, String);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
Users.update(userId, {
|
Users.update(userId, {
|
||||||
$set: {
|
$set: {
|
||||||
emails: [
|
emails: [
|
||||||
|
|
@ -1372,7 +1370,7 @@ if (Meteor.isServer) {
|
||||||
setInitials(initials, userId) {
|
setInitials(initials, userId) {
|
||||||
check(initials, String);
|
check(initials, String);
|
||||||
check(userId, String);
|
check(userId, String);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
Users.update(userId, {
|
Users.update(userId, {
|
||||||
$set: {
|
$set: {
|
||||||
'profile.initials': initials,
|
'profile.initials': initials,
|
||||||
|
|
@ -1385,7 +1383,7 @@ if (Meteor.isServer) {
|
||||||
check(username, String);
|
check(username, String);
|
||||||
check(boardId, String);
|
check(boardId, String);
|
||||||
|
|
||||||
const inviter = Meteor.user();
|
const inviter = ReactiveCache.getCurrentUser();
|
||||||
const board = ReactiveCache.getBoard(boardId);
|
const board = ReactiveCache.getBoard(boardId);
|
||||||
const allowInvite =
|
const allowInvite =
|
||||||
inviter &&
|
inviter &&
|
||||||
|
|
@ -1526,11 +1524,11 @@ if (Meteor.isServer) {
|
||||||
|
|
||||||
if (!Meteor.users.findOne(userId))
|
if (!Meteor.users.findOne(userId))
|
||||||
throw new Meteor.Error(404, 'User not found');
|
throw new Meteor.Error(404, 'User not found');
|
||||||
if (!Meteor.user().isAdmin)
|
if (!ReactiveCache.getCurrentUser().isAdmin)
|
||||||
throw new Meteor.Error(403, 'Permission denied');
|
throw new Meteor.Error(403, 'Permission denied');
|
||||||
|
|
||||||
ImpersonatedUsers.insert({
|
ImpersonatedUsers.insert({
|
||||||
adminId: Meteor.user()._id,
|
adminId: ReactiveCache.getCurrentUser()._id,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
reason: 'clickedImpersonate',
|
reason: 'clickedImpersonate',
|
||||||
});
|
});
|
||||||
|
|
@ -1546,7 +1544,7 @@ if (Meteor.isServer) {
|
||||||
setUsersTeamsTeamDisplayName(teamId, teamDisplayName) {
|
setUsersTeamsTeamDisplayName(teamId, teamDisplayName) {
|
||||||
check(teamId, String);
|
check(teamId, String);
|
||||||
check(teamDisplayName, String);
|
check(teamDisplayName, String);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
Users.find({
|
Users.find({
|
||||||
teams: {
|
teams: {
|
||||||
$elemMatch: { teamId: teamId },
|
$elemMatch: { teamId: teamId },
|
||||||
|
|
@ -1571,7 +1569,7 @@ if (Meteor.isServer) {
|
||||||
setUsersOrgsOrgDisplayName(orgId, orgDisplayName) {
|
setUsersOrgsOrgDisplayName(orgId, orgDisplayName) {
|
||||||
check(orgId, String);
|
check(orgId, String);
|
||||||
check(orgDisplayName, String);
|
check(orgDisplayName, String);
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
Users.find({
|
Users.find({
|
||||||
orgs: {
|
orgs: {
|
||||||
$elemMatch: { orgId: orgId },
|
$elemMatch: { orgId: orgId },
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ if (Meteor.isServer) {
|
||||||
};
|
};
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
outgoingWebhooks(integration, description, params) {
|
outgoingWebhooks(integration, description, params) {
|
||||||
if (Meteor.user()) {
|
if (ReactiveCache.getCurrentUser()) {
|
||||||
check(integration, Object);
|
check(integration, Object);
|
||||||
check(description, String);
|
check(description, String);
|
||||||
check(params, Object);
|
check(params, Object);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import moment from 'moment/min/moment-with-locales';
|
import moment from 'moment/min/moment-with-locales';
|
||||||
import escapeForRegex from 'escape-string-regexp';
|
import escapeForRegex from 'escape-string-regexp';
|
||||||
import Users from '../../models/users';
|
import Users from '../../models/users';
|
||||||
|
|
@ -78,7 +79,7 @@ Meteor.publish('myCards', function(sessionId) {
|
||||||
check(sessionId, String);
|
check(sessionId, String);
|
||||||
|
|
||||||
const queryParams = new QueryParams();
|
const queryParams = new QueryParams();
|
||||||
queryParams.addPredicate(OPERATOR_USER, Meteor.user().username);
|
queryParams.addPredicate(OPERATOR_USER, ReactiveCache.getCurrentUser().username);
|
||||||
queryParams.setPredicate(OPERATOR_LIMIT, 200);
|
queryParams.setPredicate(OPERATOR_LIMIT, 200);
|
||||||
|
|
||||||
const query = buildQuery(queryParams);
|
const query = buildQuery(queryParams);
|
||||||
|
|
@ -106,7 +107,7 @@ Meteor.publish('myCards', function(sessionId) {
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// if (!allUsers) {
|
// if (!allUsers) {
|
||||||
// queryParams.users = [Meteor.user().username];
|
// queryParams.users = [ReactiveCache.getCurrentUser().username];
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// return buildQuery(sessionId, queryParams);
|
// return buildQuery(sessionId, queryParams);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
|
|
||||||
// We use these when displaying notifications in the notificationsDrawer
|
// We use these when displaying notifications in the notificationsDrawer
|
||||||
|
|
||||||
// gets all activities associated with the current user
|
// gets all activities associated with the current user
|
||||||
|
|
@ -94,7 +96,7 @@ Meteor.publish('notificationUsers', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
function activities() {
|
function activities() {
|
||||||
const activityIds = Meteor.user()?.profile?.notifications?.map(v => v.activity) || [];
|
const activityIds = ReactiveCache.getCurrentUser()?.profile?.notifications?.map(v => v.activity) || [];
|
||||||
let ret = [];
|
let ret = [];
|
||||||
if (activityIds.length > 0) {
|
if (activityIds.length > 0) {
|
||||||
ret = Activities.find({
|
ret = Activities.find({
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import { MongoInternals } from 'meteor/mongo';
|
import { MongoInternals } from 'meteor/mongo';
|
||||||
|
|
||||||
// Sandstorm context is detected using the METEOR_SETTINGS environment variable
|
// Sandstorm context is detected using the METEOR_SETTINGS environment variable
|
||||||
|
|
@ -8,7 +9,7 @@ const isSandstorm =
|
||||||
if (Meteor.isServer) {
|
if (Meteor.isServer) {
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
getStatistics() {
|
getStatistics() {
|
||||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
if (ReactiveCache.getCurrentUser()?.isAdmin) {
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const pjson = require('/package.json');
|
const pjson = require('/package.json');
|
||||||
const statistics = {};
|
const statistics = {};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue