FEATURE: revert disallowing putting URLs in titles for TL0 users (#13970)

This reverts a part of changes introduced by https://github.com/discourse/discourse/pull/13947

In that PR I:
1. Disallowed topic feature links for TL-0 users
2. Additionally, disallowed just putting any URL in topic titles for TL-0 users

Actually, we don't need the second part. It introduced unnecessary complexity for no good reason. In fact, it tries to do the job that anti-spam plugins (like Akismet plugin) should be doing.

This PR reverts this second change.
This commit is contained in:
Andrei Prigorshnev
2021-08-06 20:07:42 +04:00
committed by GitHub
parent 0d8fd9ace6
commit 09ad3ed41d
8 changed files with 1 additions and 87 deletions

View File

@ -1,20 +0,0 @@
# frozen_string_literal: true
class UrlsInTopicTitleValidator < ActiveModel::Validator
def validate(record)
if UrlHelper.contains_url?(record.title) && !can_put_urls?(record)
record.errors.add(:base, error_message)
end
end
private
def can_put_urls?(topic)
guardian = Guardian.new(topic.acting_user)
guardian.can_put_urls_in_topic_title?
end
def error_message
I18n.t("urls_in_title_require_trust_level")
end
end