mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 05:47:31 +08:00
Extract the needs_approval?
logic
This commit is contained in:
parent
c2f7676370
commit
647dd76ba1
|
@ -28,11 +28,13 @@ class NewPostManager
|
|||
@sorted_handlers.sort_by! {|h| -h[:priority]}
|
||||
end
|
||||
|
||||
def self.user_needs_approval?(user)
|
||||
(user.post_count < SiteSetting.approve_post_count) ||
|
||||
(user.trust_level < SiteSetting.approve_unless_trust_level.to_i)
|
||||
end
|
||||
|
||||
def self.default_handler(manager)
|
||||
if (manager.user.post_count < SiteSetting.approve_post_count) ||
|
||||
(manager.user.trust_level < SiteSetting.approve_unless_trust_level.to_i)
|
||||
return manager.enqueue('default')
|
||||
end
|
||||
manager.enqueue('default') if user_needs_approval(manager.user)
|
||||
end
|
||||
|
||||
def self.queue_enabled?
|
||||
|
|
Loading…
Reference in New Issue
Block a user