Set notifications also to seen after pending close.

This commit is contained in:
Martin Edenhofer 2015-07-26 23:21:16 +02:00
parent 6581bb5873
commit eb03d82fdf

View file

@ -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