diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-24 15:36:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 09:41:54 +0200 |
commit | 687d638c2bee0d223f206168173b1b95adbad983 (patch) | |
tree | 957741b0ba704562a233181510bb8fda0102c8a5 /server/controllers/api/search.ts | |
parent | f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d (diff) | |
download | PeerTube-687d638c2bee0d223f206168173b1b95adbad983.tar.gz PeerTube-687d638c2bee0d223f206168173b1b95adbad983.tar.zst PeerTube-687d638c2bee0d223f206168173b1b95adbad983.zip |
Fetch outbox when searching an actor
Diffstat (limited to 'server/controllers/api/search.ts')
-rw-r--r-- | server/controllers/api/search.ts | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 959d79855..bb7174891 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { buildNSFWFilter } from '../../helpers/express-utils' | 2 | import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' |
3 | import { getFormattedObjects, getServerActor } from '../../helpers/utils' | 3 | import { getFormattedObjects, getServerActor } from '../../helpers/utils' |
4 | import { VideoModel } from '../../models/video/video' | 4 | import { VideoModel } from '../../models/video/video' |
5 | import { | 5 | import { |
@@ -88,7 +88,7 @@ async function searchVideoChannelURI (search: string, isWebfingerSearch: boolean | |||
88 | 88 | ||
89 | if (isUserAbleToSearchRemoteURI(res)) { | 89 | if (isUserAbleToSearchRemoteURI(res)) { |
90 | try { | 90 | try { |
91 | const actor = await getOrCreateActorAndServerAndModel(uri) | 91 | const actor = await getOrCreateActorAndServerAndModel(uri, true, true) |
92 | videoChannel = actor.VideoChannel | 92 | videoChannel = actor.VideoChannel |
93 | } catch (err) { | 93 | } catch (err) { |
94 | logger.info('Cannot search remote video channel %s.', uri, { err }) | 94 | logger.info('Cannot search remote video channel %s.', uri, { err }) |
@@ -152,10 +152,3 @@ async function searchVideoURI (url: string, res: express.Response) { | |||
152 | data: video ? [ video.toFormattedJSON() ] : [] | 152 | data: video ? [ video.toFormattedJSON() ] : [] |
153 | }) | 153 | }) |
154 | } | 154 | } |
155 | |||
156 | function isUserAbleToSearchRemoteURI (res: express.Response) { | ||
157 | const user: User = res.locals.oauth ? res.locals.oauth.token.User : undefined | ||
158 | |||
159 | return CONFIG.SEARCH.REMOTE_URI.ANONYMOUS === true || | ||
160 | (CONFIG.SEARCH.REMOTE_URI.USERS === true && user !== undefined) | ||
161 | } | ||