Fix timeline double requests due to templates

This one is a bit embarrassing..
This commit is contained in:
Zed 2020-05-02 19:23:47 +02:00
parent 5d561eacf1
commit 1bd48ea8ca
2 changed files with 6 additions and 4 deletions

View File

@ -7,10 +7,11 @@ import ".."/[query, types, api, agents]
import ../views/general
template respResolved*(url, kind: string): untyped =
if url.len == 0:
let u = url
if u.len == 0:
resp showError("Invalid $1 link" % kind, cfg)
else:
redirect(url)
redirect(u)
proc createResolverRouter*(cfg: Config) =
router resolver:

View File

@ -78,9 +78,10 @@ proc showTimeline*(request: Request; query: Query; cfg: Config; prefs: Prefs;
rss=rss, images = @[p.getUserpic("_200x200")])
template respTimeline*(timeline: typed) =
if timeline.len == 0:
let t = timeline
if t.len == 0:
resp Http404, showError("User \"" & @"name" & "\" not found", cfg)
resp timeline
resp t
proc createTimelineRouter*(cfg: Config) =
setProfileCacheTime(cfg.profileCacheTime)