diff --git a/app/article_list.py b/app/article_list.py index e251cc7..ef03317 100644 --- a/app/article_list.py +++ b/app/article_list.py @@ -35,7 +35,7 @@ class Headline: async def get_next_page(params: ContentListParams) -> List[Headline]: page_size = 20 if not params.page_size or params.page_size > 100 else params.page_size - query = Content.filter(flagged=False) + query = Content.filter(flagged=False, image_id__isnull=False, markdown__isnull=False) if params.search: query = query.filter( diff --git a/app/get_content.py b/app/get_content.py index d082681..c191167 100644 --- a/app/get_content.py +++ b/app/get_content.py @@ -1,13 +1,9 @@ -from uuid import uuid4 - import markdown_it from fastapi import APIRouter, HTTPException, Request, BackgroundTasks -from starlette.responses import HTMLResponse, RedirectResponse +from starlette.responses import HTMLResponse -from app.create import create_article_and_remove_task from app.models import Content from app.template import render_template -from app.wait import background_ids router = APIRouter() @@ -18,12 +14,7 @@ async def get_content(request: Request, background_tasks: BackgroundTasks, slug: str): content = await Content.filter(slug=slug).first() if content is None: - if len(background_ids) > 0: - raise HTTPException(status_code=404, detail="Content not found") - identifier = str(uuid4()) - background_ids[identifier] = True - background_tasks.add_task(create_article_and_remove_task, identifier, slug) - return RedirectResponse(url=f"/wait/{identifier}", status_code=303) + raise HTTPException(status_code=404, detail="Content not found") html = markdown.render(content.markdown or "") return render_template( "content.html", request,