Always show retweets unless excluded in search

This commit is contained in:
Zed
2020-06-17 14:12:38 +02:00
parent 0e58c36bae
commit 33f0ab0ba5
4 changed files with 9 additions and 16 deletions

View File

@@ -21,8 +21,9 @@ proc showRss*(req: Request; hostname: string; query: Query): Future[Rss] {.async
(profile, timeline) =
await fetchSingleTimeline(after, query, skipRail=true)
else:
let multiQuery = query.getMultiQuery(names)
timeline = await getSearch[Tweet](multiQuery, after)
var q = query
q.fromUser = names
timeline = await getSearch[Tweet](q, after)
# this is kinda dumb
profile = Profile(
username: name,

View File

@@ -13,7 +13,7 @@ export search
proc createSearchRouter*(cfg: Config) =
router search:
get "/search/?":
if @"q".len > 200:
if @"q".len > 500:
resp Http400, showError("Search input too long.", cfg)
let

View File

@@ -73,12 +73,6 @@ proc fetchSingleTimeline*(after: string; query: Query; skipRail=false):
return (profile, timeline, await rail)
proc getMultiQuery*(q: Query; names: seq[string]): Query =
result = q
result.fromUser = names
if q.kind == posts and "replies" notin q.excludes:
result.excludes.add "replies"
proc get*(req: Request; key: string): string =
params(req).getOrDefault(key)
@@ -118,7 +112,7 @@ proc createTimelineRouter*(cfg: Config) =
var query = request.getQuery(@"tab", @"name")
if names.len != 1:
query = query.getMultiQuery(names)
query.fromUser = names
if @"scroll".len > 0:
if query.fromUser.len != 1: