diff options
author | Dominik Ferber <dominik.ferber@gmail.com> | 2015-10-27 17:40:38 +0100 |
---|---|---|
committer | Dominik Ferber <dominik.ferber@gmail.com> | 2015-10-27 17:40:38 +0100 |
commit | 3956a6ec205b753c55a2d11f8f780acb996bb461 (patch) | |
tree | 53757ddb7bc0e4cbace00e2d6136eb3df025bb1e /models | |
parent | 3ad672a20b8e216684bbcb932b792d67548c2484 (diff) | |
download | wekan-3956a6ec205b753c55a2d11f8f780acb996bb461.tar.gz wekan-3956a6ec205b753c55a2d11f8f780acb996bb461.tar.bz2 wekan-3956a6ec205b753c55a2d11f8f780acb996bb461.zip |
Add eslint-plugin-meteor
Add rules for eslint-plugin-meteor.
Use local version of eslint and eslint-plugin-meteor, instead of
relying on global versions. Ensures consistent versions of eslint and
eslint-plugin-meteor for all developers.
Diffstat (limited to 'models')
-rw-r--r-- | models/attachments.js | 2 | ||||
-rw-r--r-- | models/users.js | 32 |
2 files changed, 20 insertions, 14 deletions
diff --git a/models/attachments.js b/models/attachments.js index 8ef0fef0..01e467ff 100644 --- a/models/attachments.js +++ b/models/attachments.js @@ -1,4 +1,4 @@ -Attachments = new FS.Collection('attachments', { +Attachments = new FS.Collection('attachments', { // eslint-disable-line meteor/collections stores: [ // XXX Add a new store for cover thumbnails so we don't load big images in diff --git a/models/users.js b/models/users.js index b35104ec..1e69564d 100644 --- a/models/users.js +++ b/models/users.js @@ -1,4 +1,4 @@ -Users = Meteor.users; +Users = Meteor.users; // eslint-disable-line meteor/collections // Search a user in the complete server database by its name or username. This // is used for instance to add a new user to a board. @@ -8,6 +8,24 @@ Users.initEasySearch(searchInFields, { returnFields: [...searchInFields, 'profile.avatarUrl'], }); +if (Meteor.isClient) { + Users.helpers({ + isBoardMember() { + const board = Boards.findOne(Session.get('currentBoard')); + return board && + _.contains(_.pluck(board.members, 'userId'), this._id) && + _.where(board.members, {userId: this._id})[0].isActive; + }, + + isBoardAdmin() { + const board = Boards.findOne(Session.get('currentBoard')); + return board && + this.isBoardMember(board) && + _.where(board.members, {userId: this._id})[0].isAdmin; + }, + }); +} + Users.helpers({ boards() { return Boards.find({ userId: this._id }); @@ -23,18 +41,6 @@ Users.helpers({ return _.contains(starredBoards, boardId); }, - isBoardMember() { - const board = Boards.findOne(Session.get('currentBoard')); - return board && _.contains(_.pluck(board.members, 'userId'), this._id) && - _.where(board.members, {userId: this._id})[0].isActive; - }, - - isBoardAdmin() { - const board = Boards.findOne(Session.get('currentBoard')); - return board && this.isBoardMember(board) && - _.where(board.members, {userId: this._id})[0].isAdmin; - }, - getAvatarUrl() { // Although we put the avatar picture URL in the `profile` object, we need // to support Sandstorm which put in the `picture` attribute by default. |