mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 07:34:45 +02:00
Merge pull request #2076 from internetee/2026-mark_orphan_notification_read
Mark orphan notification as read
This commit is contained in:
commit
2c0221bb2b
2 changed files with 26 additions and 0 deletions
|
@ -27,6 +27,7 @@ module Epp
|
||||||
|
|
||||||
Rails.logger.error 'orphan message, error ignored: ' + problem.to_s
|
Rails.logger.error 'orphan message, error ignored: ' + problem.to_s
|
||||||
# now we should dequeue or delete the messages avoid duplicate log alarms
|
# now we should dequeue or delete the messages avoid duplicate log alarms
|
||||||
|
@notification.mark_as_read
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,31 @@ class EppPollTest < EppTestCase
|
||||||
assert_equal 'Your domain has been updated', xml_doc.at_css('msgQ msg').text
|
assert_equal 'Your domain has been updated', xml_doc.at_css('msgQ msg').text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_clears_orphan_messages_if_any
|
||||||
|
# To check if we are clearing orphan messages we need to create a message not linked to any
|
||||||
|
# existing Epp::Domain
|
||||||
|
|
||||||
|
orphan_notification = @notification.dup
|
||||||
|
orphan_notification.attached_obj_type = Epp::Domain
|
||||||
|
orphan_notification.attached_obj_id = rand(Epp::Domain.first.id-1)
|
||||||
|
orphan_notification.save!
|
||||||
|
assert orphan_notification.unread?
|
||||||
|
|
||||||
|
request_xml = <<-XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee', for_version: '1.0')}">
|
||||||
|
<command>
|
||||||
|
<poll op="req"/>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
post epp_poll_path, params: { frame: request_xml },
|
||||||
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
|
|
||||||
|
orphan_notification.reload
|
||||||
|
refute orphan_notification.unread?
|
||||||
|
end
|
||||||
|
|
||||||
def test_does_not_drop_error_if_old_version
|
def test_does_not_drop_error_if_old_version
|
||||||
version = Version::DomainVersion.last
|
version = Version::DomainVersion.last
|
||||||
@notification.update(attached_obj_type: 'DomainVersion', attached_obj_id: version.id)
|
@notification.update(attached_obj_type: 'DomainVersion', attached_obj_id: version.id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue