mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
🐛Add user getClans undefined check
This commit is contained in:
parent
b918408061
commit
4515c8f765
1 changed files with 2 additions and 2 deletions
|
@ -541,10 +541,10 @@ UserHandler = class UserHandler extends Handler
|
|||
|
||||
getClans: (req, res, userIDOrSlug) ->
|
||||
@getDocumentForIdOrSlug userIDOrSlug, (err, user) =>
|
||||
return @sendNotFoundError(res) if not user
|
||||
return @sendNotFoundError(res) unless user
|
||||
clanIDs = user.get('clans') ? []
|
||||
query = {$and: [{_id: {$in: clanIDs}}]}
|
||||
query['$and'].push {type: 'public'} unless req.user.id is user.id
|
||||
query['$and'].push {type: 'public'} unless req.user?.id is user.id
|
||||
Clan.find query, (err, documents) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
@sendSuccess(res, documents)
|
||||
|
|
Loading…
Reference in a new issue