FIX: skip notifications when topic is not found
This commit is contained in:
		
							parent
							
								
									77dc3abc12
								
							
						
					
					
						commit
						06bcfc587c
					
				|  | @ -68,6 +68,7 @@ module DiscourseAssign | |||
|     end | ||||
| 
 | ||||
|     def call | ||||
|       return if topic.nil? | ||||
|       Assigner.publish_topic_tracking_state(topic, user.id) | ||||
|       unless mark_as_read? | ||||
|         PostAlerter.new(post).create_notification_alert( | ||||
|  |  | |||
|  | @ -24,6 +24,20 @@ RSpec.describe DiscourseAssign::CreateNotification do | |||
|         create_notification | ||||
|       end | ||||
| 
 | ||||
|       context "when topic is not found" do | ||||
|         before { assignment.topic = nil } | ||||
| 
 | ||||
|         it "does not publish topic tracking state" do | ||||
|           Assigner.expects(:publish_topic_tracking_state).never | ||||
|           create_notification | ||||
|         end | ||||
| 
 | ||||
|         it "does not create a notification alert" do | ||||
|           alerter.expects(:create_notification_alert).never | ||||
|           create_notification | ||||
|         end | ||||
|       end | ||||
| 
 | ||||
|       context "when `mark_as_read` is false" do | ||||
|         let(:excerpt) do | ||||
|           I18n.t( | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue