mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
correct bad error reporting.
This commit is contained in:
parent
629fa1223f
commit
7d86d23eec
1 changed files with 4 additions and 10 deletions
|
@ -8,16 +8,10 @@ module Jobs
|
||||||
|
|
||||||
topic = Topic.find_by(id: topic_id)
|
topic = Topic.find_by(id: topic_id)
|
||||||
|
|
||||||
# there are 3 cases here
|
# Topic may be hard deleted due to spam, no point complaining
|
||||||
# 1. topic was atomically nuked, this should be skipped
|
# we would have to look at the topics table id sequence to find cases
|
||||||
# 2. topic was deleted, this should be skipped
|
# where this was called with an invalid id, no point really
|
||||||
# 3. error an incorrect topic_id was sent
|
return unless topic.present?
|
||||||
|
|
||||||
unless topic.present?
|
|
||||||
max_id = Topic.with_deleted.maximum(:id).to_i
|
|
||||||
raise Discourse::InvalidParameters.new(:topic_id) if max_id < topic_id
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
topic.feature_topic_users(args)
|
topic.feature_topic_users(args)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue