mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: Introducing new UI for changing User's notification levels (#7248)
* FEATURE: Introducing new UI for tracking User's ignored or muted states
This commit is contained in:
@ -390,6 +390,17 @@ class Guardian
|
||||
UserExport.where(user_id: @user.id, created_at: (Time.zone.now.beginning_of_day..Time.zone.now.end_of_day)).count == 0
|
||||
end
|
||||
|
||||
def can_mute_user?(user_id)
|
||||
can_mute_users? &&
|
||||
@user.id != user_id &&
|
||||
User.where(id: user_id, admin: false, moderator: false).exists?
|
||||
end
|
||||
|
||||
def can_mute_users?
|
||||
return false if anonymous?
|
||||
@user.staff? || @user.trust_level >= TrustLevel.levels[:basic]
|
||||
end
|
||||
|
||||
def can_ignore_user?(user_id)
|
||||
can_ignore_users? && @user.id != user_id && User.where(id: user_id, admin: false, moderator: false).exists?
|
||||
end
|
||||
|
Reference in New Issue
Block a user