FIX: Don't cook user fields to apply watched words (#17590)

The previous method for reused the PrettyText logic which applied the
watched word logic, but had the unwanted effect of cooking the text too.
This meant that regular text values were converted to HTML.

Follow up to commit 5a4c35f62714d2d72bc0ee57a10e08116bdc476a.
This commit is contained in:
Bianca Nenciu
2022-07-26 18:15:42 +03:00
committed by GitHub
parent 171789f47a
commit 5f13ca5e54
6 changed files with 101 additions and 51 deletions

View File

@ -224,6 +224,16 @@ RSpec.describe User do
it { is_expected.to be_valid }
end
context "when user fields contain URL" do
let(:value) { "https://discourse.org" }
let(:user_field_value) { user.reload.user_fields[user_field.id.to_s] }
it "is not cooked" do
user.save!
expect(user_field_value).to eq "https://discourse.org"
end
end
context "with a multiselect user field" do
fab!(:user_field) do
Fabricate(:user_field, field_type: 'multiselect', show_on_profile: true) do