FIX: Don't give two errors about not being able to post links

This commit is contained in:
Robin Ward 2018-04-05 12:54:19 -04:00
parent 56ca87bb01
commit e27edfe597
1 changed files with 4 additions and 2 deletions

View File

@ -16,7 +16,6 @@ class Validators::PostValidator < ActiveModel::Validator
max_images_validator(record)
max_attachments_validator(record)
can_post_links_validator(record)
newuser_links_validator(record)
unique_post_validator(record)
end
@ -110,10 +109,13 @@ class Validators::PostValidator < ActiveModel::Validator
end
def can_post_links_validator(post)
return if (post.link_count == 0 && !post.has_oneboxes?) ||
if (post.link_count == 0 && !post.has_oneboxes?) ||
Guardian.new(post.acting_user).can_post_link? ||
private_message?(post)
return newuser_links_validator(post)
end
post.errors.add(:base, I18n.t(:links_require_trust))
end