mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
FIX: Don't raise an error if TopicStatusUpdate
has been deleted.
This commit is contained in:
parent
406d721f11
commit
69661be500
@ -2,15 +2,15 @@ module Jobs
|
||||
class ToggleTopicClosed < Jobs::Base
|
||||
def execute(args)
|
||||
topic_status_update = TopicStatusUpdate.find_by(id: args[:topic_status_update_id])
|
||||
raise Discourse::InvalidParameters.new(:topic_status_update_id) if topic_status_update.blank?
|
||||
|
||||
return if topic_status_update.execute_at > Time.zone.now
|
||||
|
||||
topic = topic_status_update.topic
|
||||
return if topic.blank?
|
||||
|
||||
state = !!args[:state]
|
||||
return if topic.closed == state
|
||||
|
||||
if topic_status_update.blank? ||
|
||||
topic_status_update.execute_at > Time.zone.now ||
|
||||
(topic = topic_status_update.topic).blank? ||
|
||||
topic.closed == state
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
user = topic_status_update.user
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user