Set notifications also to seen after pending close.
This commit is contained in:
parent
6581bb5873
commit
eb03d82fdf
1 changed files with 10 additions and 2 deletions
|
@ -222,20 +222,28 @@ returns
|
||||||
|
|
||||||
=begin
|
=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)
|
ticket = Ticket.find(1)
|
||||||
seen = ticket.online_notification_seen_state
|
seen = ticket.online_notification_seen_state
|
||||||
|
|
||||||
returns
|
returns
|
||||||
|
|
||||||
result = [user1, user2, ...]
|
result = true # or false
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def online_notification_seen_state
|
def online_notification_seen_state
|
||||||
state = Ticket::State.lookup( id: state_id )
|
state = Ticket::State.lookup( id: state_id )
|
||||||
state_type = Ticket::StateType.lookup( id: state.state_type_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 == 'closed'
|
||||||
return true if state_type.name == 'merged'
|
return true if state_type.name == 'merged'
|
||||||
false
|
false
|
||||||
|
|
Loading…
Reference in a new issue