Fix currentUser refresh from anonymous

stable
Álex Hermida 2018-12-11 11:34:47 +01:00 committed by Alex Hermida
parent c99022a166
commit 57f848dbca
1 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,6 @@ class UserListService
] ]
constructor: (@currentUserService, @projectService) -> constructor: (@currentUserService, @projectService) ->
@.currentUser = @currentUserService.getUser()?.toJS()
filterUsers: (text, user) -> filterUsers: (text, user) ->
username = user.full_name_display.toUpperCase() username = user.full_name_display.toUpperCase()
@ -37,9 +36,10 @@ class UserListService
return _.includes(username, text) return _.includes(username, text)
searchUsers: (text, excludedUser) -> searchUsers: (text, excludedUser) ->
@.currentUser = @currentUserService.getUser()
users = _.clone(@projectService.activeMembers.toJS(), true) users = _.clone(@projectService.activeMembers.toJS(), true)
users = _.reject(users, {"id": excludedUser.id}) if excludedUser users = _.reject(users, {"id": excludedUser.id}) if excludedUser
users = _.sortBy(users, (o) => if o.id is @.currentUser.id then 0 else o.id) users = _.sortBy(users, (o) => if o.id is @.currentUser?.get('id') then 0 else o.id)
users = _.filter(users, _.partial(@.filterUsers, text)) if text? users = _.filter(users, _.partial(@.filterUsers, text)) if text?
return users return users