From f745ecfbdc30bfdae65f8196b3bf64c90f5b111a Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Mon, 3 Jun 2019 11:39:28 -0400 Subject: [PATCH] Rename adsense_ads_txt setting to ads_txt --- config/locales/server.en.yml | 2 +- config/settings.yml | 8 ++++---- .../20190603112536_rename_site_setting_ads_txt.rb | 11 +++++++++++ plugin.rb | 4 ++-- 4 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20190603112536_rename_site_setting_ads_txt.rb diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 5fbdbfb..de0d297 100755 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -3,6 +3,7 @@ en: no_ads_for_groups: "Don't show ads to users in these groups." house_ads_after_nth_post: 'If "Between posts" house ads are defined, show an ad after every N posts, where N is this value.' house_ads_frequency: "If other ad networks are configured to show in an ad slot, how often should house ads be shown, as a percentage." + ads_txt: "Contents of your ads.txt file. More details available at this Google AdSense help page." dfp_publisher_id: "Input your Google Ad Manager (formerly called DFP) network code, which is found in your network settings." dfp_through_trust_level: "Show your ads to users based on trust levels. Users with trust level higher than this value will not see ads." @@ -55,7 +56,6 @@ en: adsense_post_bottom_ad_sizes: "Choose your ad size" adsense_mobile_post_bottom_ad_size: "Choose your ad size" adsense_nth_post_code: "Show an ad after every N posts, where N is this value." - adsense_ads_txt: "Contents of your ads.txt file. More details available at this Google AdSense help page." amazon_through_trust_level: "Show your ads to users based on trust levels. Users with trust level higher than this value will not see ads." amazon_topic_list_top_src_code: "Enter src code to display at topic list top location" diff --git a/config/settings.yml b/config/settings.yml index 6409cb0..f09c59c 100755 --- a/config/settings.yml +++ b/config/settings.yml @@ -13,6 +13,10 @@ ad_plugin: default: 100 min: 0 max: 100 + ads_txt: + client: false + default: "" + textarea: true adsense_plugin: adsense_publisher_code: @@ -124,10 +128,6 @@ adsense_plugin: client: true default: "" min: 1 - adsense_ads_txt: - client: false - default: "" - textarea: true dfp_plugin: dfp_publisher_id: diff --git a/db/migrate/20190603112536_rename_site_setting_ads_txt.rb b/db/migrate/20190603112536_rename_site_setting_ads_txt.rb new file mode 100644 index 0000000..2ae9da6 --- /dev/null +++ b/db/migrate/20190603112536_rename_site_setting_ads_txt.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RenameSiteSettingAdsTxt < ActiveRecord::Migration[5.2] + def up + execute "UPDATE site_settings SET name = 'ads_txt' WHERE name = 'adsense_ads_txt'" + end + + def down + execute "UPDATE site_settings SET name = 'adsense_ads_txt' WHERE name = 'ads_txt'" + end +end diff --git a/plugin.rb b/plugin.rb index 0205b8c..d3ce092 100755 --- a/plugin.rb +++ b/plugin.rb @@ -43,9 +43,9 @@ after_initialize do skip_before_action :check_xhr def index - raise Discourse::NotFound unless SiteSetting.adsense_ads_txt.present? + raise Discourse::NotFound unless SiteSetting.ads_txt.present? - render plain: SiteSetting.adsense_ads_txt + render plain: SiteSetting.ads_txt end end