A platform for community discussion. Free, open, simple.
DEV: check for author repo in gifs component installed (#41050)
David Battersby9d6e597bab24
diff --git a/lib/discourse_gifs.rb b/lib/discourse_gifs.rbindex 7284f05b421..b3a6867c907 100644--- a/lib/discourse_gifs.rb+++ b/lib/discourse_gifs.rb@@ -1,9 +1,14 @@# frozen_string_literal: truemodule DiscourseGifs- REPO_URL = "https://github.com/discourse/discourse-gifs"COMPONENT_NAME = "discourse-gifs"- REMOTE_URLS = [REPO_URL, "#{REPO_URL}.git"].freeze++ 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"] }.freezedef self.component_installed?component_scope.exists?diff --git a/spec/lib/discourse_gifs_spec.rb b/spec/lib/discourse_gifs_spec.rbindex 062e59383ab..285aa91e78f 100644--- a/spec/lib/discourse_gifs_spec.rb+++ b/spec/lib/discourse_gifs_spec.rb@@ -21,6 +21,13 @@ RSpec.describe DiscourseGifs doexpect(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" doremote_theme = RemoteTheme.create!(remote_url: "https://github.com/myorg/discourse-gifs.git")Fabricate(:theme, component: true, remote_theme: remote_theme)