mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 10:40:48 +08:00
This PR makes sure crawler localization URLs only work when anonymous users can resolve the locale from the URL param. This blocks enabling the crawler param without that prerequisite and keeps hreflang, canonical URLs, and crawler link rewriting behind the same guard. /406195/4
16 lines
342 B
Ruby
Vendored
16 lines
342 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
class ContentLocalizationCrawlerParamValidator
|
|
def initialize(opts = {})
|
|
@opts = opts
|
|
end
|
|
|
|
def valid_value?(val)
|
|
return true if val == "f"
|
|
SiteSetting.set_locale_from_param
|
|
end
|
|
|
|
def error_message
|
|
I18n.t("site_settings.errors.content_localization_crawler_param_requirements")
|
|
end
|
|
end
|