From 79f1afa5376642ffc21a2c55ced1599e63f5df37 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 24 Sep 2021 04:02:25 +0200 Subject: [PATCH] dfs --- files/routes/front.py | 3 +-- files/routes/posts.py | 26 ++------------------------ files/routes/search.py | 2 -- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index cf45ed966..787e7eb4b 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -151,7 +151,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' ) if not (v and v.changelogsub): - posts=posts.join(Submission.submission_aux) posts=posts.filter(not_(Submission.title.ilike(f'[changelog]%'))) if v and filter_words: @@ -257,7 +256,7 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs): Submission.author_id.notin_(blocked) ) - posts=posts.join(Submission.submission_aux).join(Submission.author) + posts=posts.join(Submission.author) posts=posts.filter(Submission.title.ilike(f'_changelog%', User.admin_level == 6)) if t != 'all': diff --git a/files/routes/posts.py b/files/routes/posts.py index 0e3bb312d..cc20cb535 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -490,23 +490,6 @@ def thumbnail_thread(pid): soup=BeautifulSoup(x.content, 'html.parser') #parse html - #first, set metadata - try: - meta_title=soup.find('title') - if meta_title: - post.submission_aux.meta_title=str(meta_title.string)[0:500] - - meta_desc = soup.find('meta', attrs={"name":"description"}) - if meta_desc: - post.submission_aux.meta_description=meta_desc['content'][0:1000] - - if meta_title or meta_desc: - db.add(post.submission_aux) - db.commit() - - except Exception as e: - pass - #create list of urls to check thumb_candidate_urls=[] @@ -616,7 +599,7 @@ def submit_post(v): if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/") - repost = g.db.query(Submission).join(Submission.submission_aux).options(lazyload('*')).filter( + repost = g.db.query(Submission).options(lazyload('*')).filter( Submission.url.ilike(url), Submission.deleted_utc == 0, Submission.is_banned == False @@ -659,7 +642,7 @@ def submit_post(v): body = request.values.get("body", "") # check for duplicate - dup = g.db.query(Submission).join(Submission.submission_aux).options(lazyload('*')).filter( + dup = g.db.query(Submission).options(lazyload('*')).filter( Submission.author_id == v.id, Submission.deleted_utc == 0, @@ -716,8 +699,6 @@ def submit_post(v): similar_posts = g.db.query(Submission).options( lazyload('*') - ).join( - Submission.submission_aux ).filter( #or_( # and_( @@ -735,8 +716,6 @@ def submit_post(v): if url: similar_urls = g.db.query(Submission).options( lazyload('*') - ).join( - Submission.submission_aux ).filter( #or_( # and_( @@ -934,7 +913,6 @@ def submit_post(v): ), 400 g.db.add(new_post) - g.db.add(new_post.submission_aux) g.db.flush() diff --git a/files/routes/search.py b/files/routes/search.py index 375e24e34..fa21d45fa 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -60,8 +60,6 @@ def searchposts(v): posts = g.db.query(Submission).options( lazyload('*') - ).join( - Submission.submission_aux, ).join( Submission.author )