discourse/app/serializers/remote_theme_serializer.rb
David Taylor 0b37b99fde
FEATURE: Allow changing source repo/branch/key for theme after installation (#38169)
Introduces a new 'change source' button:

<img width="504" height="292" alt="SCR-20260402-olrv"
src="https://github.com/user-attachments/assets/9a48983f-4fcd-4f8d-a07d-4668933f0fc8"
/>

<img width="621" height="318" alt="SCR-20260402-olss"
src="https://github.com/user-attachments/assets/294a89e0-284c-4bb9-adc5-705656897395"
/>

---------

Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2026-04-02 16:56:19 +01:00

40 lines
1 KiB
Ruby

# frozen_string_literal: true
class RemoteThemeSerializer < ApplicationSerializer
attributes :id,
:remote_url,
:remote_version,
:local_version,
:commits_behind,
:branch,
:remote_updated_at,
:updated_at,
:github_diff_link,
:last_error_text,
:is_git?,
:license_url,
:about_url,
:authors,
:theme_version,
:minimum_discourse_version,
:maximum_discourse_version,
:has_private_key
def has_private_key
object.private_key.present?
end
# ActiveModelSerializer has some pretty nutty logic where it tries to find
# the path here from action dispatch, tell it not to
def about_url
object.about_url if UrlHelper.is_valid_url?(object.about_url)
end
def license_url
object.license_url if UrlHelper.is_valid_url?(object.license_url)
end
def include_github_diff_link?
github_diff_link.present?
end
end