FIX: Don't show the link button in the composer if linking is disabled

This commit is contained in:
Robin Ward
2018-02-08 12:56:10 -05:00
parent 8c89f5704d
commit dedeb2deb8
6 changed files with 48 additions and 6 deletions

View File

@ -93,7 +93,9 @@ class Validators::PostValidator < ActiveModel::Validator
end
def can_post_links_validator(post)
return if post.link_count == 0 || acting_user_is_trusted?(post, SiteSetting.min_trust_to_post_links) || private_message?(post)
return if post.link_count == 0 ||
Guardian.new(post.acting_user).can_post_link? ||
private_message?(post)
post.errors.add(:base, I18n.t(:links_require_trust))
end