Skip to content

Commit

Permalink
Use the User type instead of Profile
Browse files Browse the repository at this point in the history
  • Loading branch information
FIGBERT committed May 9, 2022
1 parent 69d4aaa commit 3056d7c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/routes/home.nim
Expand Up @@ -37,13 +37,13 @@ proc createHomeRouter*(cfg: Config) =
prefs = cookiePrefs()
names = getNames(prefs.following)
var
profs: seq[Profile]
profs: seq[User]
query = request.getQuery("", prefs.following)
query.fromUser = names
query.kind = userList

for name in names:
let prof = await getCachedProfile(name)
let prof = await getCachedUser(name)
profs &= @[prof]

resp renderMain(renderFollowing(query, profs, prefs), request, cfg, prefs)
4 changes: 2 additions & 2 deletions src/views/home.nim
Expand Up @@ -2,7 +2,7 @@ import karax/[karaxdsl, vdom]
import search, timeline, renderutils
import ../types

proc renderFollowingUsers*(results: seq[Profile]; prefs: Prefs): VNode =
proc renderFollowingUsers*(results: seq[User]; prefs: Prefs): VNode =
buildHtml(tdiv(class="timeline")):
for user in results:
renderUser(user, prefs)
Expand All @@ -26,7 +26,7 @@ proc renderHome*(results: Result[Tweet]; prefs: Prefs; path: string): VNode =

renderTimelineTweets(results, prefs, path)

proc renderFollowing*(query: Query; following: seq[Profile]; prefs: Prefs): VNode =
proc renderFollowing*(query: Query; following: seq[User]; prefs: Prefs): VNode =
buildHtml(tdiv(class="timeline-container")):
renderHomeTabs(query)
renderFollowingUsers(following, prefs)
4 changes: 2 additions & 2 deletions src/views/profile.nim
Expand Up @@ -30,9 +30,9 @@ proc renderUserCard*(user: User; prefs: Prefs; path: string): VNode =
linkUser(user, class="profile-card-username")
let following = isFollowing(user.username, prefs.following)
if not following:
buttonReferer "/follow/" & profile.username, "Follow", path, "profile-card-follow-button"
buttonReferer "/follow/" & user.username, "Follow", path, "profile-card-follow-button"
else:
buttonReferer "/unfollow/" & profile.username, "Unfollow", path, "profile-card-follow-button"
buttonReferer "/unfollow/" & user.username, "Unfollow", path, "profile-card-follow-button"

tdiv(class="profile-card-extra"):
if user.bio.len > 0:
Expand Down

0 comments on commit 3056d7c

Please sign in to comment.