Only set online notifications to seen for non ticket owners.
This commit is contained in:
parent
7c46db4be4
commit
77fedbe108
2 changed files with 31 additions and 5 deletions
|
@ -278,6 +278,10 @@ returns
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def online_notification_seen_state(user_id_check = nil)
|
def online_notification_seen_state(user_id_check = nil)
|
||||||
|
|
||||||
|
# always to set unseen for ticket owner
|
||||||
|
return false if user_id_check && user_id_check == owner_id && user_id_check != updated_by_id
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_equal(ticket1.online_notification_seen_state, true)
|
assert_equal(ticket1.online_notification_seen_state, true)
|
||||||
assert_equal(ticket1.online_notification_seen_state(agent_user1.id), true)
|
assert_equal(ticket1.online_notification_seen_state(agent_user1.id), false)
|
||||||
assert_equal(ticket1.online_notification_seen_state(agent_user2.id), true)
|
assert_equal(ticket1.online_notification_seen_state(agent_user2.id), true)
|
||||||
|
|
||||||
# to open, all to seen
|
# to open, all to seen
|
||||||
|
@ -405,6 +405,28 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
assert_equal(ticket1.online_notification_seen_state(agent_user1.id), false)
|
assert_equal(ticket1.online_notification_seen_state(agent_user1.id), false)
|
||||||
assert_equal(ticket1.online_notification_seen_state(agent_user2.id), false)
|
assert_equal(ticket1.online_notification_seen_state(agent_user2.id), false)
|
||||||
|
|
||||||
|
# to closed, all only others to seen
|
||||||
|
ticket1.update_attributes(
|
||||||
|
owner_id: agent_user1.id,
|
||||||
|
state: Ticket::State.lookup(name: 'closed'),
|
||||||
|
updated_by_id: agent_user2.id,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_equal(ticket1.online_notification_seen_state, true)
|
||||||
|
assert_equal(ticket1.online_notification_seen_state(agent_user1.id), false)
|
||||||
|
assert_equal(ticket1.online_notification_seen_state(agent_user2.id), true)
|
||||||
|
|
||||||
|
# to closed by owner self, all to seen
|
||||||
|
ticket1.update_attributes(
|
||||||
|
owner_id: agent_user1.id,
|
||||||
|
state: Ticket::State.lookup(name: 'closed'),
|
||||||
|
updated_by_id: agent_user1.id,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_equal(ticket1.online_notification_seen_state, true)
|
||||||
|
assert_equal(ticket1.online_notification_seen_state(agent_user1.id), true)
|
||||||
|
assert_equal(ticket1.online_notification_seen_state(agent_user2.id), true)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def notification_check(online_notifications, checks)
|
def notification_check(online_notifications, checks)
|
||||||
|
|
Loading…
Reference in a new issue