From 0ef33b396a1a3b7a0c29801aae3e87ed8db6718d Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 26 Jun 2022 07:45:49 +0200 Subject: [PATCH] make checking if a post is subscribed to less retarded --- files/classes/submission.py | 4 ++++ files/templates/post_actions.html | 2 +- files/templates/post_actions_mobile.html | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 290cb87a8..0008b8339 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -508,3 +508,7 @@ class Submission(Base): @lazy def is_saved(self, v): return g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=self.id).first() + + @lazy + def is_subscribed(self, v): + return g.db.query(Subscription).filter_by(user_id=v.id, submission_id=self.id).first() \ No newline at end of file diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index 8ae3f3ef0..0717f8b2b 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -15,7 +15,7 @@ Copy link {% if v %} - Subscribe + Subscribe Unsubscribe {% endif %} diff --git a/files/templates/post_actions_mobile.html b/files/templates/post_actions_mobile.html index f5e655155..9bc28658a 100644 --- a/files/templates/post_actions_mobile.html +++ b/files/templates/post_actions_mobile.html @@ -14,8 +14,8 @@ - - + +