diff --git a/client/src/models/Board.js b/client/src/models/Board.js index 8e9fef2db..cdb8a62b5 100755 --- a/client/src/models/Board.js +++ b/client/src/models/Board.js @@ -1,3 +1,4 @@ +import orderBy from 'lodash/orderBy'; import { attr, fk, many } from 'redux-orm'; import BaseModel from './BaseModel'; @@ -218,10 +219,6 @@ export default class extends BaseModel { } } - getOrderedMembershipsQuerySet() { - return this.memberships.orderBy('createdAt'); - } - getOrderedLabelsQuerySet() { return this.labels.orderBy('position'); } @@ -230,6 +227,12 @@ export default class extends BaseModel { return this.lists.orderBy('position'); } + getOrderedMembershipsModelArray() { + return orderBy(this.memberships.toModelArray(), (boardMembershipModel) => + boardMembershipModel.user.name.toLocaleLowerCase(), + ); + } + getMembershipModelForUser(userId) { return this.memberships .filter({ diff --git a/client/src/models/User.js b/client/src/models/User.js index b2e99ccc4..747ebc9e0 100755 --- a/client/src/models/User.js +++ b/client/src/models/User.js @@ -298,7 +298,7 @@ export default class extends BaseModel { static getOrderedUndeletedQuerySet() { return this.filter({ deletedAt: null, - }).orderBy('createdAt'); + }).orderBy((user) => user.name.toLocaleLowerCase()); } getOrderedProjectManagersQuerySet() { diff --git a/client/src/selectors/boards.js b/client/src/selectors/boards.js index e4e435cd0..4bb02d33b 100644 --- a/client/src/selectors/boards.js +++ b/client/src/selectors/boards.js @@ -55,17 +55,14 @@ export const selectMembershipsForCurrentBoard = createSelector( return boardModel; } - return boardModel - .getOrderedMembershipsQuerySet() - .toModelArray() - .map((boardMembershipModel) => ({ - ...boardMembershipModel.ref, - isPersisted: !isLocalId(boardMembershipModel.id), - user: { - ...boardMembershipModel.user.ref, - isCurrent: boardMembershipModel.user.id === currentUserId, - }, - })); + return boardModel.getOrderedMembershipsModelArray().map((boardMembershipModel) => ({ + ...boardMembershipModel.ref, + isPersisted: !isLocalId(boardMembershipModel.id), + user: { + ...boardMembershipModel.user.ref, + isCurrent: boardMembershipModel.user.id === currentUserId, + }, + })); }, );