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

@ -1653,29 +1653,6 @@ RSpec.describe TopicsController do
end
end
describe "urls in the title" do
let!(:title_with_url) { "A title with the URL https://google.com" }
it "doesn't allow TL0 users to put urls into the title" do
sign_in(trust_level_0)
topic = Fabricate(:topic, user: trust_level_0)
Fabricate(:post, topic: topic)
put "/t/#{topic.slug}/#{topic.id}.json", params: { title: title_with_url }
expect(response.status).to eq(422)
expect(response.body).to include(I18n.t('urls_in_title_require_trust_level'))
end
it "allows TL1 users to put urls into the title" do
sign_in(trust_level_1)
topic = Fabricate(:topic, user: trust_level_1)
Fabricate(:post, topic: topic)
put "/t/#{topic.slug}/#{topic.id}.json", params: { title: title_with_url }
expect(response.status).to eq(200)
end
end
describe "featured links" do
def fabricate_topic(user, category = nil)
topic = Fabricate(:topic, user: user, category: category)