Fix user list service
parent
4a8a59a771
commit
b0c82769c3
|
@ -366,7 +366,6 @@ $compile, avatarService, $userListService) ->
|
|||
|
||||
render = (selected, text) ->
|
||||
users = $userListService.searchUsers(text, selected)
|
||||
|
||||
visibleUsers = _.slice(users, 0, 5)
|
||||
visibleUsers = _.map visibleUsers, (user) ->
|
||||
user.avatar = avatarService.getAvatar(user)
|
||||
|
|
|
@ -36,7 +36,7 @@ class PageMixin
|
|||
@scope.activeUsersById = groupBy(@scope.activeUsers, (e) -> e.id)
|
||||
|
||||
@scope.users = _.sortBy(users, "full_name_display")
|
||||
@scope.usersById = groupBy(@scope.users, (e) -> e.id)
|
||||
@scope.usersById = groupBy(users, (e) -> e.id)
|
||||
|
||||
@scope.roles = _.sortBy(roles, "order")
|
||||
computableRoles = _(@scope.project.members).map("role").uniq().value()
|
||||
|
|
|
@ -28,7 +28,6 @@ class UserListService
|
|||
|
||||
constructor: (@currentUserService, @projectService) ->
|
||||
@.currentUser = @currentUserService.getUser().toJS()
|
||||
@.members = @projectService.project.toJS().members
|
||||
|
||||
filterUsers: (text, user) ->
|
||||
username = user.full_name_display.toUpperCase()
|
||||
|
@ -38,7 +37,7 @@ class UserListService
|
|||
return _.includes(username, text)
|
||||
|
||||
searchUsers: (text, excludedUser) ->
|
||||
users = _.clone(@.members, true)
|
||||
users = _.clone(@projectService.activeMembers.toJS(), true)
|
||||
users = _.reject(users, {"id": excludedUser.id}) if excludedUser
|
||||
users = _.sortBy(users, (o) => if o.id is @.currentUser.id then 0 else o.id)
|
||||
users = _.filter(users, _.partial(@.filterUsers, text)) if text?
|
||||
|
|
Loading…
Reference in New Issue