mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 06:17:00 +08:00
DEV: add site setting to disable watched word checking in user fields (#25411)
adding a hidden sitesetting, `disable_watched_word_checking_in_user_fields` - false by default. if set to true, you can use any word at all in user profile fields. meta: https://meta.discourse.org/t/watched-words-scope/282699/20
This commit is contained in:
@ -281,6 +281,11 @@ RSpec.describe User do
|
||||
context "when user field is private" do
|
||||
before { user_field.update(show_on_profile: false) }
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
end
|
||||
context "when SiteSetting.disable_watched_word_checking_in_user_fields is true" do
|
||||
before { SiteSetting.disable_watched_word_checking_in_user_fields = true }
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
end
|
||||
end
|
||||
@ -296,6 +301,15 @@ RSpec.describe User do
|
||||
user.save!
|
||||
expect(user_field_value).to eq "■■■■■■■■ word"
|
||||
end
|
||||
|
||||
context "when SiteSetting.disable_watched_word_checking_in_user_fields is true" do
|
||||
before { SiteSetting.disable_watched_word_checking_in_user_fields = true }
|
||||
|
||||
it "does not censor the words upon saving" do
|
||||
user.save!
|
||||
expect(user_field_value).to eq "censored word"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when user field is private" do
|
||||
@ -324,6 +338,14 @@ RSpec.describe User do
|
||||
user.save!
|
||||
expect(user_field_value).to eq "word replaced"
|
||||
end
|
||||
context "when SiteSetting.disable_watched_word_checking_in_user_fields is true" do
|
||||
before { SiteSetting.disable_watched_word_checking_in_user_fields = true }
|
||||
|
||||
it "does not replace anything" do
|
||||
user.save!
|
||||
expect(user_field_value).to eq "word to replace"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when user field is private" do
|
||||
|
Reference in New Issue
Block a user