mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 09:10:25 +08:00
REFACTOR: New spec tests and code improvement
This commit is contained in:
parent
84867c1c07
commit
7cbda949f1
12 changed files with 144 additions and 51 deletions
|
@ -129,10 +129,14 @@ class Guardian
|
|||
alias :can_see_flags? :can_moderate?
|
||||
alias :can_close? :can_moderate?
|
||||
|
||||
def can_tag?(obj)
|
||||
return false unless obj && obj.is_a?(Topic)
|
||||
def can_tag?(topic)
|
||||
return false if topic.blank?
|
||||
|
||||
obj.private_message? ? can_tag_pms? : can_tag_topics?
|
||||
topic.private_message? ? can_tag_pms? : can_tag_topics?
|
||||
end
|
||||
|
||||
def can_see_tags?(topic)
|
||||
SiteSetting.tagging_enabled && topic.present? && (!topic.private_message? || can_tag_pms?)
|
||||
end
|
||||
|
||||
def can_send_activation_email?(user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue