Change comma-delim site settings to pipe-delim
This commit is contained in:
parent
b328fd0031
commit
9c4dd1cb35
|
@ -163,9 +163,9 @@ class Post < ActiveRecord::Base
|
|||
|
||||
hosts = SiteSetting
|
||||
.white_listed_spam_host_domains
|
||||
.split(",")
|
||||
.split('|')
|
||||
.map{|h| h.strip}
|
||||
.reject{|h| !h.include?(".")}
|
||||
.reject{|h| !h.include?('.')}
|
||||
|
||||
hosts << GlobalSetting.hostname
|
||||
|
||||
|
|
|
@ -742,7 +742,7 @@ cs:
|
|||
tos_url: "Pokud máte dokument 'Podmínky Používání' hostovaný samostatně, napište sem jeho plnou URL."
|
||||
privacy_policy_url: "Pokud máte dokument 'Ochrana Soukromí' hostovaný samostatně, napište sem jeho plnou URL."
|
||||
newuser_spam_host_threshold: "Kolikrát smí uživatel zaslat odkaz na stejný server v rámci příspěvků z nastavení 'newuser_spam_host_posts', než budou příspěvky považovány za spam."
|
||||
white_listed_spam_host_domains: A comma delimited list of domains excluded from spam host testing, new users will be able to create an unrestricted count of posts with links to this domain
|
||||
white_listed_spam_host_domains: A pipe-delimited list of domains excluded from spam host testing, new users will be able to create an unrestricted count of posts with links to this domain
|
||||
staff_like_weight: "Extra hodnota pro 'líbí se' od uživatelů, kteří jsou součástí personálu webu."
|
||||
reply_by_email_enabled: Jestli toto fórum umožňuje odpovědi emailem
|
||||
reply_by_email_address: 'Šablona emailé adresy pro odpověď emailem, např. %{reply_key}@reply.myforum.com'
|
||||
|
|
|
@ -606,7 +606,7 @@ en:
|
|||
max_image_height: "Maximum allowed height of images in a post"
|
||||
category_featured_topics: "Number of topics displayed per category on the /categories page. After changing this value, it takes up to 15 minutes for the categories page to update."
|
||||
add_rel_nofollow_to_user_content: "Add rel nofollow to all submitted user content, except for internal links (including parent domains) changing this requires you update all your baked markdown with: \"rake posts:rebake\""
|
||||
exclude_rel_nofollow_domains: "A comma delimited list of domains where nofollow is not added (tld.com will automatically allow sub.tld.com as well)"
|
||||
exclude_rel_nofollow_domains: "A pipe-delimited list of domains where nofollow is not added (tld.com will automatically allow sub.tld.com as well)"
|
||||
|
||||
post_excerpt_maxlength: "Maximum length in chars of a post's excerpt"
|
||||
post_onebox_maxlength: "Maximum length of a oneboxed Discourse post"
|
||||
|
@ -809,7 +809,7 @@ en:
|
|||
|
||||
newuser_spam_host_threshold: "How many times a new user can post a link to the same host within their `newuser_spam_host_posts` posts before being considered spam."
|
||||
|
||||
white_listed_spam_host_domains: "A comma delimited list of domains excluded from spam host testing, new users will be able to create an unrestricted count of posts with links to this domain"
|
||||
white_listed_spam_host_domains: "A pipe-delimited list of domains excluded from spam host testing, new users will be able to create an unrestricted count of posts with links to this domain"
|
||||
staff_like_weight: "Extra weighting factor given to likes when performed by staff."
|
||||
|
||||
reply_by_email_enabled: "Enable replying to topics via email"
|
||||
|
|
|
@ -313,7 +313,7 @@ id:
|
|||
max_image_width: "Maximum allowed width of images in a post"
|
||||
category_featured_topics: "Number of topics displayed per category in the /categories page"
|
||||
add_rel_nofollow_to_user_content: "Add rel nofollow to all submitted user content, except for internal links (including parent domains) changing this requires you update all your baked markdown"
|
||||
exclude_rel_nofollow_domains: "A comma delimited list of domains where nofollow is not added (tld.com will automatically allow sub.tld.com as well)"
|
||||
exclude_rel_nofollow_domains: "A pipe-delimited list of domains where nofollow is not added (tld.com will automatically allow sub.tld.com as well)"
|
||||
|
||||
post_excerpt_maxlength: "Maximum length in chars of a post's excerpt"
|
||||
post_onebox_maxlength: "Maximum length of a oneboxed Discourse post"
|
||||
|
|
|
@ -509,7 +509,7 @@ ko:
|
|||
max_image_height: "게시글에서 허용하는 이미지 최대 높이"
|
||||
category_featured_topics: "Number of topics displayed per category in the /categories page"
|
||||
add_rel_nofollow_to_user_content: "Add rel nofollow to all submitted user content, except for internal links (including parent domains) changing this requires you update all your baked markdown"
|
||||
exclude_rel_nofollow_domains: "A comma delimited list of domains where nofollow is not added (tld.com will automatically allow sub.tld.com as well)"
|
||||
exclude_rel_nofollow_domains: "A pipe-delimited list of domains where nofollow is not added (tld.com will automatically allow sub.tld.com as well)"
|
||||
|
||||
post_excerpt_maxlength: "Maximum length in chars of a post's excerpt"
|
||||
post_onebox_maxlength: "Maximum length of a oneboxed Discourse post"
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
class SiteSettingCommaToPipe < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<SQL
|
||||
UPDATE site_settings
|
||||
SET value = replace(value, ',', '|')
|
||||
WHERE name = 'white_listed_spam_host_domains'
|
||||
;
|
||||
SQL
|
||||
execute <<SQL
|
||||
UPDATE site_settings
|
||||
SET value = replace(value, ',', '|')
|
||||
WHERE name = 'exclude_rel_nofollow_domains'
|
||||
;
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<SQL
|
||||
UPDATE site_settings
|
||||
SET value = replace(value, '|', ',')
|
||||
WHERE name = 'white_listed_spam_host_domains'
|
||||
;
|
||||
SQL
|
||||
execute <<SQL
|
||||
UPDATE site_settings
|
||||
SET value = replace(value, '|', ',')
|
||||
WHERE name = 'exclude_rel_nofollow_domains'
|
||||
;
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -175,7 +175,7 @@ module PrettyText
|
|||
whitelist = []
|
||||
|
||||
domains = SiteSetting.exclude_rel_nofollow_domains
|
||||
whitelist = domains.split(",") if domains.present?
|
||||
whitelist = domains.split('|') if domains.present?
|
||||
|
||||
site_uri = nil
|
||||
doc = Nokogiri::HTML.fragment(html)
|
||||
|
|
|
@ -45,7 +45,7 @@ describe PrettyText do
|
|||
describe "rel nofollow" do
|
||||
before do
|
||||
SiteSetting.stubs(:add_rel_nofollow_to_user_content).returns(true)
|
||||
SiteSetting.stubs(:exclude_rel_nofollow_domains).returns("foo.com,bar.com")
|
||||
SiteSetting.stubs(:exclude_rel_nofollow_domains).returns("foo.com|bar.com")
|
||||
end
|
||||
|
||||
it "should inject nofollow in all user provided links" do
|
||||
|
|
|
@ -810,7 +810,7 @@ describe Post do
|
|||
|
||||
post.has_host_spam?.should == true
|
||||
|
||||
SiteSetting.stubs(:white_listed_spam_host_domains).returns("bla.com,boo.com , somesite.com ")
|
||||
SiteSetting.stubs(:white_listed_spam_host_domains).returns("bla.com|boo.com | somesite.com ")
|
||||
post.has_host_spam?.should == false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue