forked from retoor/devplacepy
fix: correct spelling of "Update" in commit message to "Update"
This commit is contained in:
+9
-3
@@ -23,6 +23,8 @@ from devplacepy.database import (
|
||||
get_news_images_by_uids,
|
||||
get_setting,
|
||||
get_int_setting,
|
||||
diversify_by_author,
|
||||
get_user_post_count,
|
||||
)
|
||||
from devplacepy.templating import templates
|
||||
from devplacepy.responses import respond, wants_json, json_error
|
||||
@@ -441,8 +443,6 @@ async def shutdown():
|
||||
@app.get("/")
|
||||
async def landing(request: Request):
|
||||
user = get_current_user(request)
|
||||
if user:
|
||||
return RedirectResponse(url="/feed", status_code=302)
|
||||
|
||||
landing_articles = []
|
||||
if "news" in db.tables:
|
||||
@@ -470,7 +470,10 @@ async def landing(request: Request):
|
||||
landing_posts = []
|
||||
if "posts" in db.tables:
|
||||
posts_table = get_table("posts")
|
||||
raw_posts = list(posts_table.find(order_by=["-created_at"], _limit=6))
|
||||
raw_posts = list(
|
||||
posts_table.find(deleted_at=None, order_by=["-created_at"], _limit=50)
|
||||
)
|
||||
raw_posts = diversify_by_author(raw_posts, max_per_author=2, limit=6)
|
||||
if raw_posts:
|
||||
post_uids = [p["uid"] for p in raw_posts]
|
||||
author_uids = [p["user_uid"] for p in raw_posts]
|
||||
@@ -503,6 +506,9 @@ async def landing(request: Request):
|
||||
{
|
||||
**seo_ctx,
|
||||
"request": request,
|
||||
"user": user,
|
||||
"is_authenticated": bool(user),
|
||||
"user_post_count": get_user_post_count(user["uid"]) if user else 0,
|
||||
"landing_articles": landing_articles,
|
||||
"landing_posts": landing_posts,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user