From ad47e9524a4455b36dd6b0ea5196d640eb2a0e11 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 25 Apr 2022 21:52:30 +0200 Subject: [PATCH] dfs --- files/classes/submission.py | 2 ++ files/routes/front.py | 5 +++++ files/routes/posts.py | 3 +++ 3 files changed, 10 insertions(+) diff --git a/files/classes/submission.py b/files/classes/submission.py index b30cf1e19..d4ec956fc 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -19,6 +19,8 @@ class Submission(Base): __tablename__ = "submissions" id = Column(Integer, primary_key=True) + if SITE in ('cringetopia.org','watchpeopledie.co'): + site = Column(Integer) author_id = Column(Integer, ForeignKey("users.id")) edited_utc = Column(Integer, default=0) created_utc = Column(Integer) diff --git a/files/routes/front.py b/files/routes/front.py index e0ba3ac24..59b773ec2 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -318,6 +318,8 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" elif v.subs == 3: posts = posts.filter(Submission.sub != None, Submission.sub.notin_(v.all_blocks)) + if site == 'cringetopia.org': posts = posts.filter_by(site=1) + elif site == 'watchpeopledie.co': posts = posts.filter_by(site=2) if gt: posts = posts.filter(Submission.created_utc > gt) if lt: posts = posts.filter(Submission.created_utc < lt) @@ -398,6 +400,9 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" if v and v.admin_level < 2: pins = pins.filter(Submission.author_id.notin_(v.userblocks)) + if site == 'cringetopia.org': pins = pins.filter_by(site=1) + elif site == 'watchpeopledie.co': pins = pins.filter_by(site=2) + pins = pins.all() for pin in pins: diff --git a/files/routes/posts.py b/files/routes/posts.py index 760568876..d3754c93c 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1128,6 +1128,9 @@ def submit_post(v, sub=None): ghost=ghost ) + if SITE == 'cringetopia.org': post.site = 1 + elif SITE == 'watchpeopledie.co': post.site = 2 + g.db.add(post) g.db.flush()