A platform for community discussion. Free, open, simple.
DEV: remove enable gifs upcoming change metadata (#41798)
David Battersby6d51f7b4f84b
diff --git a/config/site_settings.yml b/config/site_settings.ymlindex df4332d5867..7cf47a92a34 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -1698,13 +1698,7 @@ posting:enable_gifs:default: falseclient: true- hidden: truearea: "gifs"- upcoming_change:- status: "stable"- impact: "feature,all_members"- learn_more_url: "https://meta.discourse.org/t/-/404829"- permanent_warning: falseklipy_api_key:default: ""secret: truediff --git a/lib/discourse_gifs.rb b/lib/discourse_gifs.rbdeleted file mode 100644index b3a6867c907..00000000000--- a/lib/discourse_gifs.rb+++ /dev/null@@ -1,23 +0,0 @@-# frozen_string_literal: true--module DiscourseGifs- COMPONENT_NAME = "discourse-gifs"-- REPO_URLS = %w[- https://github.com/discourse/discourse-gifs- https://github.com/xfalcox/discourse-gifs- ].freeze-- REMOTE_URLS = REPO_URLS.flat_map { |url| [url, "#{url}.git"] }.freeze-- def self.component_installed?- component_scope.exists?- end-- def self.component_scope- Theme- .joins(:remote_theme)- .where(component: true)- .where(remote_themes: { remote_url: REMOTE_URLS })- end-enddiff --git a/lib/tasks/migrate_discourse_gifs_to_core.rake b/lib/tasks/migrate_discourse_gifs_to_core.rakeindex b543b1267cd..3d6b9ad16e4 100644--- a/lib/tasks/migrate_discourse_gifs_to_core.rake+++ b/lib/tasks/migrate_discourse_gifs_to_core.rake@@ -1,8 +1,15 @@# frozen_string_literal: true-require "discourse_gifs"-module DiscourseGifsMigration+ COMPONENT_NAME = "discourse-gifs"++ REPO_URLS = %w[+ https://github.com/discourse/discourse-gifs+ https://github.com/xfalcox/discourse-gifs+ ].freeze++ REMOTE_URLS = REPO_URLS.flat_map { |url| [url, "#{url}.git"] }.freeze+# Klipy expects locale in xx_YY form (ISO 639-1 language + ISO 3166-1 alpha-2# country). Giphy stores a bare language code, so each of its locale choices is# translated to a representative xx_YY. Where a language spans several countries@@ -174,9 +181,7 @@ module DiscourseGifsMigrationmigrate_component(theme, enable_gifs: enable_gifs)end- unless migrated_any- puts "\nNo #{DiscourseGifs::COMPONENT_NAME} theme component found. Nothing to migrate."- end+ puts "\nNo #{COMPONENT_NAME} theme component found. Nothing to migrate." unless migrated_anyenddef each_target_db@@ -198,19 +203,13 @@ module DiscourseGifsMigrationdef find_component_in_db(db)puts "Accessing database: #{db_label(db)} (#{RailsMultisite::ConnectionManagement.current_hostname})"- puts "Searching for #{DiscourseGifs::COMPONENT_NAME} theme component..."+ puts "Searching for #{COMPONENT_NAME} theme component..."themes =- RemoteTheme- .where(remote_url: DiscourseGifs::REMOTE_URLS)- .includes(theme: :theme_settings)- .map(&:theme)+ RemoteTheme.where(remote_url: REMOTE_URLS).includes(theme: :theme_settings).map(&:theme)if themes.length > 1- status(- "Multiple (#{themes.length}) #{DiscourseGifs::COMPONENT_NAME} components found:",- :yellow,- )+ status("Multiple (#{themes.length}) #{COMPONENT_NAME} components found:", :yellow)themes.each { |t| item("#{t.name} (ID: #{t.id})") }status("Install a single instance before running this task.", :yellow)return nil@@ -252,7 +251,7 @@ module DiscourseGifsMigrationtarget[:name],new_value,Discourse.system_user,- "Migrated from #{DiscourseGifs::COMPONENT_NAME} theme component",+ "Migrated from #{COMPONENT_NAME} theme component",)next unless changed@@ -273,7 +272,7 @@ module DiscourseGifsMigration:enable_gifs,true,Discourse.system_user,- "Migrated from #{DiscourseGifs::COMPONENT_NAME} theme component",+ "Migrated from #{COMPONENT_NAME} theme component",)success("enable_gifs: true (auto-enabled after migration)")migrated += 1@@ -304,7 +303,7 @@ module DiscourseGifsMigration(hosts + missing).join("|"),Discourse.system_user,"Added Klipy media hosts so gifs stay blocked after migrating from " \- "#{DiscourseGifs::COMPONENT_NAME} theme component",+ "#{COMPONENT_NAME} theme component",)success("disabled_image_download_domains += #{missing.join(", ")} " \@@ -338,7 +337,7 @@ module DiscourseGifsMigrationendend-desc "Migrate #{DiscourseGifs::COMPONENT_NAME} theme component settings to core site settings. " \+desc "Migrate discourse-gifs theme component settings to core site settings. " \"enable_gifs is flipped to true after migration by default; set ENABLE_GIFS=0 to skip that."task "themes:discourse_gifs:migrate" => :environment doenable_gifs = !%w[false no 0].include?(ENV["ENABLE_GIFS"].to_s.strip.downcase)diff --git a/lib/upcoming_changes.rb b/lib/upcoming_changes.rbindex 8642e8bdc6f..41c5914a649 100644--- a/lib/upcoming_changes.rb+++ b/lib/upcoming_changes.rb@@ -43,12 +43,6 @@ module UpcomingChangesThemes::Action::HorizonHighContextTopicCardsToggled.should_display_upcoming_change?end- # Sites already running the discourse-gifs theme component will have their- # configuration migrated separately so they don't need to opt in via the upcoming change.- def self.should_display_enable_gifs?- !DiscourseGifs.component_installed?- end-# Only relevant on sites that currently allow uncategorized topics, and must# stay visible after being enabled (which disables that setting).def self.should_display_remove_and_replace_uncategorized?diff --git a/public/images/upcoming_changes/enable_gifs.png b/public/images/upcoming_changes/enable_gifs.pngdeleted file mode 100644index aebac7cae56..00000000000Binary files a/public/images/upcoming_changes/enable_gifs.png and /dev/null differdiff --git a/spec/lib/discourse_gifs_spec.rb b/spec/lib/discourse_gifs_spec.rbdeleted file mode 100644index 285aa91e78f..00000000000--- a/spec/lib/discourse_gifs_spec.rb+++ /dev/null@@ -1,38 +0,0 @@-# frozen_string_literal: true--RSpec.describe DiscourseGifs do- describe ".component_installed?" do- it "returns false when no discourse-gifs theme component exists" do- expect(described_class.component_installed?).to eq(false)- end-- it "returns true when the component is installed via the canonical URL" do- remote_theme = RemoteTheme.create!(remote_url: "https://github.com/discourse/discourse-gifs")- Fabricate(:theme, component: true, remote_theme: remote_theme)-- expect(described_class.component_installed?).to eq(true)- end-- it "returns true when the component is installed via the .git URL" do- remote_theme =- RemoteTheme.create!(remote_url: "https://github.com/discourse/discourse-gifs.git")- Fabricate(:theme, component: true, remote_theme: remote_theme)-- expect(described_class.component_installed?).to eq(true)- end-- it "returns true when installed via the author's repo" do- remote_theme = RemoteTheme.create!(remote_url: "https://github.com/xfalcox/discourse-gifs")- Fabricate(:theme, component: true, remote_theme: remote_theme)-- expect(described_class.component_installed?).to eq(true)- end-- it "returns false for forks or similarly-named repos that the migration task would not match" do- remote_theme = RemoteTheme.create!(remote_url: "https://github.com/myorg/discourse-gifs.git")- Fabricate(:theme, component: true, remote_theme: remote_theme)-- expect(described_class.component_installed?).to eq(false)- end- end-end