This commit is contained in:
Aevann1 2021-09-24 04:02:25 +02:00
parent 95df0fcc12
commit f45c501a8e
3 changed files with 3 additions and 28 deletions

View file

@ -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): if not (v and v.changelogsub):
posts=posts.join(Submission.submission_aux)
posts=posts.filter(not_(Submission.title.ilike(f'[changelog]%'))) posts=posts.filter(not_(Submission.title.ilike(f'[changelog]%')))
if v and filter_words: 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) 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)) posts=posts.filter(Submission.title.ilike(f'_changelog%', User.admin_level == 6))
if t != 'all': if t != 'all':

View file

@ -490,23 +490,6 @@ def thumbnail_thread(pid):
soup=BeautifulSoup(x.content, 'html.parser') soup=BeautifulSoup(x.content, 'html.parser')
#parse html #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 #create list of urls to check
thumb_candidate_urls=[] 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/"): if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"):
url = url.replace("https://streamable.com/", "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.url.ilike(url),
Submission.deleted_utc == 0, Submission.deleted_utc == 0,
Submission.is_banned == False Submission.is_banned == False
@ -659,7 +642,7 @@ def submit_post(v):
body = request.values.get("body", "") body = request.values.get("body", "")
# check for duplicate # 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.author_id == v.id,
Submission.deleted_utc == 0, Submission.deleted_utc == 0,
@ -716,8 +699,6 @@ def submit_post(v):
similar_posts = g.db.query(Submission).options( similar_posts = g.db.query(Submission).options(
lazyload('*') lazyload('*')
).join(
Submission.submission_aux
).filter( ).filter(
#or_( #or_(
# and_( # and_(
@ -735,8 +716,6 @@ def submit_post(v):
if url: if url:
similar_urls = g.db.query(Submission).options( similar_urls = g.db.query(Submission).options(
lazyload('*') lazyload('*')
).join(
Submission.submission_aux
).filter( ).filter(
#or_( #or_(
# and_( # and_(
@ -934,7 +913,6 @@ def submit_post(v):
), 400 ), 400
g.db.add(new_post) g.db.add(new_post)
g.db.add(new_post.submission_aux)
g.db.flush() g.db.flush()

View file

@ -60,8 +60,6 @@ def searchposts(v):
posts = g.db.query(Submission).options( posts = g.db.query(Submission).options(
lazyload('*') lazyload('*')
).join(
Submission.submission_aux,
).join( ).join(
Submission.author Submission.author
) )