A platform for community discussion. Free, open, simple.
FIX: Changing theme source URL (#40564)
jlzlt567a01528be9
diff --git a/frontend/discourse/admin/components/modal/change-theme-source.gjs b/frontend/discourse/admin/components/modal/change-theme-source.gjsindex 4ba29bd371f..1820144e3a3 100644--- a/frontend/discourse/admin/components/modal/change-theme-source.gjs+++ b/frontend/discourse/admin/components/modal/change-theme-source.gjs@@ -16,6 +16,7 @@ export default class ChangeThemeSourceModal extends Component {@tracked loading = false;@tracked generateNewKey = false;@tracked remoteUrl = this.args.model.theme.remote_theme?.remote_url || "";+ @tracked formApi = null;@cachedget data() {@@ -40,8 +41,9 @@ export default class ChangeThemeSourceModal extends Component {}@action- onRemoteUrlChange(value) {+ onRemoteUrlChange(value, { set, name }) {this.remoteUrl = value;+ set(name, value);}@actiondiff --git a/spec/system/admin_customize_themes_spec.rb b/spec/system/admin_customize_themes_spec.rbindex 76438ca851e..0113ec790a2 100644--- a/spec/system/admin_customize_themes_spec.rb+++ b/spec/system/admin_customize_themes_spec.rb@@ -305,12 +305,14 @@ describe "Admin Customize Themes" dothemeend- it "shows the change source button for git themes" do- theme_page.visit(git_theme)- expect(page).to have_button(I18n.t("admin_js.admin.customize.theme.change_source.button"))- end+ it "opens the change source modal with pre-filled values, and allows submitting" do+ # Stub the git fetch so the update succeeds without hitting a real remote.+ allow_any_instance_of(RemoteTheme).to receive(:update_from_remote) do |remote_theme|+ remote_theme.save!+ end++ new_url = "https://github.com/discourse/some-other-theme.git"- it "opens the change source modal with pre-filled values" dotheme_page.visit(git_theme)find("button", text: I18n.t("admin_js.admin.customize.theme.change_source.button")).click@@ -319,6 +321,12 @@ describe "Admin Customize Themes" do"https://github.com/discourse/example-theme.git",)expect(find(".admin-change-theme-source-modal input.branch").value).to eq("main")++ find(".admin-change-theme-source-modal input.repo-url").fill_in(with: new_url)+ find(".admin-change-theme-source-modal button.btn-primary").click++ expect(page).to have_no_css(".admin-change-theme-source-modal")+ expect(git_theme.reload.remote_theme.remote_url).to eq(new_url)endit "does not show the change source button for local themes" do