aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-07-25 22:01:25 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-07-25 22:01:25 +0200
commitc1e791bad0b079af67398f6407221e6dcbb573dd (patch)
tree82e5944b4458dd35aa482a38f6b650eb93bb89ad /server/models/oauth
parent5f7021c33d31c5255b995ae0ff86b5bbea4ea4b9 (diff)
downloadPeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.gz
PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.zst
PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.zip
expliciting type checks and predicates (server only)
Diffstat (limited to 'server/models/oauth')
-rw-r--r--server/models/oauth/oauth-token.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts
index 759aa2779..026c30135 100644
--- a/server/models/oauth/oauth-token.ts
+++ b/server/models/oauth/oauth-token.ts
@@ -154,9 +154,12 @@ export class OAuthTokenModel extends Model<OAuthTokenModel> {
154 return OAuthTokenModel.scope(ScopeNames.WITH_ACCOUNT) 154 return OAuthTokenModel.scope(ScopeNames.WITH_ACCOUNT)
155 .findOne(query) 155 .findOne(query)
156 .then(token => { 156 .then(token => {
157 token['user'] = token.User 157 if (token) {
158 158 token['user'] = token.User
159 return token 159 return token
160 } else {
161 return new OAuthTokenModel()
162 }
160 }) 163 })
161 } 164 }
162 165