diff options
| author | rubenwardy <rw@rubenwardy.com> | 2020-07-11 00:53:03 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2020-07-11 00:53:03 +0100 |
| commit | 5f7be4b4337358e35c9eda4b261260a08a958b4a (patch) | |
| tree | 1a24fe62c3ba28d1867fb6a3fbbd475f8b6a2aba /app/blueprints/threads | |
| parent | 9bf20df941deb666c0452cb425cf337d425dc59d (diff) | |
| download | cheatdb-5f7be4b4337358e35c9eda4b261260a08a958b4a.tar.xz | |
Add package and created_at to Notifications
Diffstat (limited to 'app/blueprints/threads')
| -rw-r--r-- | app/blueprints/threads/__init__.py | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/app/blueprints/threads/__init__.py b/app/blueprints/threads/__init__.py index ad58545..a4728a0 100644 --- a/app/blueprints/threads/__init__.py +++ b/app/blueprints/threads/__init__.py @@ -106,14 +106,8 @@ def view(id): if not current_user in thread.watchers: thread.watchers.append(current_user) - msg = None - if thread.package is None: - msg = "New comment on '{}'".format(thread.title) - else: - msg = "New comment on '{}' on package {}".format(thread.title, thread.package.title) - - - addNotification(thread.watchers, current_user, msg, url_for("threads.view", id=thread.id)) + msg = "New comment on '{}'".format(thread.title) + addNotification(thread.watchers, current_user, msg, url_for("threads.view", id=thread.id), thread.package) db.session.commit() return redirect(url_for("threads.view", id=id)) @@ -200,15 +194,12 @@ def new(): if is_review_thread: package.review_thread = thread - notif_msg = None + notif_msg = "New thread '{}'".format(thread.title) if package is not None: - notif_msg = "New thread '{}' on package {}".format(thread.title, package.title) - addNotification(package.maintainers, current_user, notif_msg, url_for("threads.view", id=thread.id)) - else: - notif_msg = "New thread '{}'".format(thread.title) + addNotification(package.maintainers, current_user, notif_msg, url_for("threads.view", id=thread.id), package) editors = User.query.filter(User.rank >= UserRank.EDITOR).all() - addNotification(editors, current_user, notif_msg, url_for("threads.view", id=thread.id)) + addNotification(editors, current_user, notif_msg, url_for("threads.view", id=thread.id), package) db.session.commit() |
