mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Prefer ES5 methods over underscore utilities
Since 07cc454 (ie the switch to Meteor 1.2) we includes the `es5-shim`
polyfill to support methods like `Array.prototype.forEach` in a
consistent way across all supported browsers (IE8+).
MDG recently released a blog post recommending the use of these native
methods instead of underscore [0]. We know follow this recommendation.
This commit also favor some ES6 features (argument defaults,
destructing assignment) in places where we didn’t use them.
[0]: http://info.meteor.com/blog/es2015-get-started
This commit is contained in:
parent
c6b12dc5ad
commit
aa974aa54a
14 changed files with 33 additions and 31 deletions
|
|
@ -43,7 +43,7 @@ Migrations.add('board-background-color', () => {
|
|||
});
|
||||
|
||||
Migrations.add('lowercase-board-permission', () => {
|
||||
_.forEach(['Public', 'Private'], (permission) => {
|
||||
['Public', 'Private'].forEach((permission) => {
|
||||
Boards.update(
|
||||
{ permission },
|
||||
{ $set: { permission: permission.toLowerCase() } },
|
||||
|
|
@ -116,11 +116,11 @@ Migrations.add('add-member-isactive-field', () => {
|
|||
const formerUsers = _.difference(allUsersWithSomeActivity, currentUsers);
|
||||
|
||||
const newMemberSet = [];
|
||||
_.forEach(board.members, (member) => {
|
||||
board.members.forEach((member) => {
|
||||
member.isActive = true;
|
||||
newMemberSet.push(member);
|
||||
});
|
||||
_.forEach(formerUsers, (userId) => {
|
||||
formerUsers.forEach((userId) => {
|
||||
newMemberSet.push({
|
||||
userId,
|
||||
isAdmin: false,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Meteor.publish('boards', function() {
|
|||
|
||||
// Defensive programming to verify that starredBoards has the expected
|
||||
// format -- since the field is in the `profile` a user can modify it.
|
||||
const starredBoards = Users.findOne(this.userId).profile.starredBoards || [];
|
||||
const {starredBoards = []} = Users.findOne(this.userId).profile;
|
||||
check(starredBoards, [String]);
|
||||
|
||||
return Boards.find({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue