Update
This commit is contained in:
@@ -28,6 +28,11 @@ from devplacepy.database import (
|
||||
mark_notifications_read_by_target,
|
||||
resolve_object_url,
|
||||
)
|
||||
from devplacepy.database.awards import (
|
||||
can_give_award,
|
||||
get_prominent_award,
|
||||
get_user_awards,
|
||||
)
|
||||
from devplacepy.content import can_view_project, enrich_items
|
||||
from devplacepy.utils import (
|
||||
get_current_user,
|
||||
@@ -147,6 +152,17 @@ async def profile_page(
|
||||
if tab == "media":
|
||||
media, media_pagination = get_user_media(profile_user["uid"], page)
|
||||
|
||||
awards, awards_pagination = [], None
|
||||
if tab == "awards":
|
||||
awards, awards_pagination = get_user_awards(profile_user["uid"], page)
|
||||
prominent_award = get_prominent_award(profile_user)
|
||||
awards_count = int(profile_user.get("award_count") or 0)
|
||||
can_give = bool(
|
||||
current_user
|
||||
and current_user["uid"] != profile_user["uid"]
|
||||
and can_give_award(current_user["uid"], profile_user["uid"])
|
||||
)
|
||||
|
||||
posts = []
|
||||
if tab == "posts":
|
||||
posts_table = get_table("posts")
|
||||
@@ -404,6 +420,11 @@ async def profile_page(
|
||||
"follow_pagination": follow_pagination,
|
||||
"followers_count": follow_counts["followers"],
|
||||
"following_count": follow_counts["following"],
|
||||
"awards": awards,
|
||||
"awards_pagination": awards_pagination,
|
||||
"awards_count": awards_count,
|
||||
"prominent_award": prominent_award,
|
||||
"can_give_award": can_give,
|
||||
},
|
||||
model=ProfileOut,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user