DEV: Use User#human? User#bot? (#7140)
This commit is contained in:
parent
d1d9a4f128
commit
32bae48fd3
|
@ -20,7 +20,7 @@ module Jobs
|
|||
|
||||
if count > 0
|
||||
target_usernames = Group[:moderators].users.map do |user|
|
||||
next if user.id < 0
|
||||
next if user.bot?
|
||||
|
||||
unseen_count = user.notifications.joins(:topic)
|
||||
.where("notifications.id > ?", user.seen_notification_id)
|
||||
|
|
|
@ -294,6 +294,10 @@ class User < ActiveRecord::Base
|
|||
self.id > 0
|
||||
end
|
||||
|
||||
def bot?
|
||||
!self.human?
|
||||
end
|
||||
|
||||
def effective_locale
|
||||
if SiteSetting.allow_user_locale && self.locale.present?
|
||||
self.locale
|
||||
|
|
|
@ -13,7 +13,7 @@ class PostAlerter
|
|||
|
||||
def not_allowed?(user, post)
|
||||
user.blank? ||
|
||||
user.id < 0 ||
|
||||
user.bot? ||
|
||||
user.id == post.user_id
|
||||
end
|
||||
|
||||
|
@ -279,8 +279,7 @@ class PostAlerter
|
|||
|
||||
DiscourseEvent.trigger(:before_create_notification, user, type, post, opts)
|
||||
|
||||
return if user.blank?
|
||||
return if user.id < 0
|
||||
return if user.blank? || user.bot?
|
||||
|
||||
is_liked = type == Notification.types[:liked]
|
||||
return if is_liked && user.user_option.like_notification_frequency == UserOption.like_notification_frequency_type[:never]
|
||||
|
|
|
@ -514,7 +514,7 @@ class PostCreator
|
|||
end
|
||||
|
||||
def create_post_notice
|
||||
return if @user.id < 0 || @user.staged
|
||||
return if @user.bot? || @user.staged
|
||||
|
||||
last_post_time = Post.where(user_id: @user.id)
|
||||
.order(created_at: :desc)
|
||||
|
|
Loading…
Reference in New Issue