From eb03d82fdf43090d11f459ef91631f02948623ce Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 26 Jul 2015 23:21:16 +0200 Subject: [PATCH] Set notifications also to seen after pending close. --- app/models/ticket.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 43dc84989..63c7f9b13 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -222,20 +222,28 @@ returns =begin -know if online notifcation should be shown as already seen +know if online notifcation should be shown as already seen with current state ticket = Ticket.find(1) seen = ticket.online_notification_seen_state returns - result = [user1, user2, ...] + result = true # or false =end def online_notification_seen_state state = Ticket::State.lookup( id: state_id ) state_type = Ticket::StateType.lookup( id: state.state_type_id ) + + # set all to seen if pending action state is a closed or merged state + if state_type.name == 'pending action' && state.next_state_id + state = Ticket::State.lookup( id: next_state_id ) + state_type = Ticket::StateType.lookup( id: state.state_type_id ) + end + + # set all to seen if new state is a closed or merged state return true if state_type.name == 'closed' return true if state_type.name == 'merged' false