diff --git a/app/models.py b/app/models.py index ef26bbdf..2487e73c 100644 --- a/app/models.py +++ b/app/models.py @@ -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 diff --git a/app/templates/threads/view.html b/app/templates/threads/view.html index 397fba33..71580de5 100644 --- a/app/templates/threads/view.html +++ b/app/templates/threads/view.html @@ -6,11 +6,24 @@ Threads {% block content %}
Package: {{ thread.package.title }}
+ {% endif %} - {% if thread.package %} -- Package: {{ thread.package.title }} -
+ {% if current_user.is_authenticated %} + {% if current_user in thread.watchers %} + + {% else %} + + {% endif %} + {% endif %} {% endif %} {% if thread.private %} diff --git a/app/views/threads.py b/app/views/threads.py index 316ca4d3..37ac3d1b 100644 --- a/app/views/threads.py +++ b/app/views/threads.py @@ -32,6 +32,41 @@ def threads_page(): query = query.filter_by(private=False) return render_template("threads/list.html", threads=query.all()) + +@app.route("/threads/