Skip to content

Commit

Permalink
Fix SQLAlchemy error by using user instead of current_user
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jul 4, 2024
1 parent 542e51e commit 894ed19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def add_notification(target, causer: User, type: NotificationType, title: str, u

if target.rank.at_least(UserRank.NEW_MEMBER) and target != causer:
session.query(Notification) \
.filter_by(user_id=target.id, causer_id=causer.id, type=type, title=title, url=url, package=package) \
.filter_by(user=target, causer=causer, type=type, title=title, url=url, package=package) \
.delete()
notif = Notification(target, causer, type, title, url, package)
session.add(notif)
Expand Down Expand Up @@ -175,7 +175,7 @@ def post_to_approval_thread(package: Package, user: User, message: str, is_statu
else:
msg = f"New comment on '{thread.title}'"

add_notification(thread.watchers, current_user, NotificationType.THREAD_REPLY, msg, thread.get_view_url(), package)
add_notification(thread.watchers, user, NotificationType.THREAD_REPLY, msg, thread.get_view_url(), package)

thread.replies.append(reply)

Expand Down

0 comments on commit 894ed19

Please sign in to comment.