Fix enable/disable notifications
This commit is contained in:
parent
d4d61d2792
commit
b46f03ea64
|
@ -83,16 +83,16 @@ def enable_notifications(owner, name, ticket_id):
|
|||
if not ticket:
|
||||
abort(404)
|
||||
|
||||
participant = get_participant_for_user(current_user)
|
||||
sub = (TicketSubscription.query
|
||||
.filter(TicketSubscription.tracker_id == None)
|
||||
.filter(TicketSubscription.ticket_id == ticket.id)
|
||||
.filter(TicketSubscription.user_id == current_user.id)
|
||||
.filter(TicketSubscription.participant_id == participant.id)
|
||||
).one_or_none()
|
||||
|
||||
if sub:
|
||||
return redirect(ticket_url(ticket))
|
||||
|
||||
participant = get_participant_for_user(current_user)
|
||||
sub = TicketSubscription()
|
||||
sub.ticket_id = ticket.id
|
||||
sub.participant_id = participant.id
|
||||
|
@ -110,10 +110,11 @@ def disable_notifications(owner, name, ticket_id):
|
|||
if not ticket:
|
||||
abort(404)
|
||||
|
||||
participant = get_participant_for_user(current_user)
|
||||
sub = (TicketSubscription.query
|
||||
.filter(TicketSubscription.tracker_id == None)
|
||||
.filter(TicketSubscription.ticket_id == ticket.id)
|
||||
.filter(TicketSubscription.user_id == current_user.id)
|
||||
.filter(TicketSubscription.participant_id == participant.id)
|
||||
).one_or_none()
|
||||
|
||||
if not sub:
|
||||
|
|
|
@ -115,10 +115,11 @@ def enable_notifications(owner, name):
|
|||
if not tracker:
|
||||
abort(404)
|
||||
|
||||
participant = get_participant_by_user(current_user)
|
||||
sub = (TicketSubscription.query
|
||||
.filter(TicketSubscription.tracker_id == tracker.id)
|
||||
.filter(TicketSubscription.ticket_id == None)
|
||||
.filter(TicketSubscription.user_id == current_user.id)
|
||||
.filter(TicketSubscription.participant_id == participant.id)
|
||||
).one_or_none()
|
||||
|
||||
if sub:
|
||||
|
@ -139,10 +140,11 @@ def disable_notifications(owner, name):
|
|||
if not tracker:
|
||||
abort(404)
|
||||
|
||||
participant = get_participant_by_user(current_user)
|
||||
sub = (TicketSubscription.query
|
||||
.filter(TicketSubscription.tracker_id == tracker.id)
|
||||
.filter(TicketSubscription.ticket_id == None)
|
||||
.filter(TicketSubscription.user_id == current_user.id)
|
||||
.filter(TicketSubscription.participant_id == participant.id)
|
||||
).one_or_none()
|
||||
|
||||
if not sub:
|
||||
|
|
Loading…
Reference in New Issue