Add subscribe/unsubscribe button

This commit is contained in:
rubenwardy
2018-07-28 15:30:59 +01:00
parent 909a2b4ce9
commit e82166f87e
3 changed files with 61 additions and 4 deletions

View File

@@ -731,6 +731,15 @@ class Thread(db.Model):
watchers = db.relationship("User", secondary=watchers, lazy="subquery", \
backref=db.backref("watching", lazy=True))
def getSubscribeURL(self):
return url_for("thread_subscribe_page",
id=self.id)
def getUnsubscribeURL(self):
return url_for("thread_unsubscribe_page",
id=self.id)
def checkPerm(self, user, perm):
if not user.is_authenticated:
return not self.private