Skip to content

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.rb
index 7284f05b421..b3a6867c907 100644
--- a/lib/discourse_gifs.rb
+++ b/lib/discourse_gifs.rb
@@ -1,9 +1,14 @@
# frozen_string_literal: true
module 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"] }.freeze
def self.component_installed?
component_scope.exists?
diff --git a/spec/lib/discourse_gifs_spec.rb b/spec/lib/discourse_gifs_spec.rb
index 062e59383ab..285aa91e78f 100644
--- a/spec/lib/discourse_gifs_spec.rb
+++ b/spec/lib/discourse_gifs_spec.rb
@@ -21,6 +21,13 @@ RSpec.describe DiscourseGifs do
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)