Cleanup
This commit is contained in:
parent
b0a5e38b3f
commit
80f7bc0a02
2 changed files with 3 additions and 3 deletions
|
@ -111,10 +111,10 @@ proc getCachedProfile*(username: string; fetch=true): Future[Profile] {.async.}
|
||||||
elif fetch:
|
elif fetch:
|
||||||
result = await getProfile(username)
|
result = await getProfile(username)
|
||||||
|
|
||||||
proc getCachedProfileScreenName*(userId: string): Future[string] {.async.} =
|
proc getCachedProfileUsername*(userId: string): Future[string] {.async.} =
|
||||||
let username = await get("i:" & userId)
|
let username = await get("i:" & userId)
|
||||||
if username != redisNil:
|
if username != redisNil:
|
||||||
result = username
|
result = username
|
||||||
else:
|
else:
|
||||||
let profile = await getProfileById(userId)
|
let profile = await getProfileById(userId)
|
||||||
result = profile.username
|
result = profile.username
|
||||||
|
|
|
@ -104,7 +104,7 @@ template respTimeline*(timeline: typed) =
|
||||||
|
|
||||||
template respUserId*() =
|
template respUserId*() =
|
||||||
cond @"user_id".len > 0
|
cond @"user_id".len > 0
|
||||||
let username = await getCachedProfileScreenName(@"user_id")
|
let username = await getCachedProfileUsername(@"user_id")
|
||||||
if username.len > 0:
|
if username.len > 0:
|
||||||
redirect("/" & username)
|
redirect("/" & username)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue