mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-04-30 21:10:03 +08:00
We want to deprecate the enabled/disabled toggle for this setting and rely entirely on the presence of a URL. This change: - Deprecates and hides the enabled/disabled setting. - Updates all code paths and tests that rely on the old setting. - Adds a migration that clears the URL if the enabled/disabled setting is set to false.
26 lines
919 B
Ruby
26 lines
919 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe UnicodeUsernameValidator do
|
|
subject(:validator) { described_class.new }
|
|
|
|
it "disallows Unicode usernames when external system avatars are disabled" do
|
|
SiteSetting.external_system_avatars_url = ""
|
|
|
|
expect(validator.valid_value?("t")).to eq(false)
|
|
expect(validator.error_message).to eq(I18n.t("site_settings.errors.unicode_usernames_avatars"))
|
|
|
|
expect(validator.valid_value?("f")).to eq(true)
|
|
expect(validator.error_message).to be_blank
|
|
end
|
|
|
|
it "allows Unicode usernames when external system avatars are enabled" do
|
|
SiteSetting.external_system_avatars_url =
|
|
"/letter_avatar_proxy/v4/letter/{first_letter}/{color}/{size}.png"
|
|
|
|
expect(validator.valid_value?("t")).to eq(true)
|
|
expect(validator.error_message).to be_blank
|
|
|
|
expect(validator.valid_value?("f")).to eq(true)
|
|
expect(validator.error_message).to be_blank
|
|
end
|
|
end
|