0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/app/serializers/remote_theme_serializer.rb
David Taylor 45d9ae88e7
FEATURE: Show theme d-compat/* refs in admin UI (#40649)
When a remote theme is installed or updated from a git repository,
Discourse may check out a compatibility-pinned ref (a `d-compat/YYYY.MM`
branch or a `.discourse-compatibility` entry) rather than the requested
branch.

Previously this wasn't obvious in the UI. This commit surfaces the
currently-running compatibility reference, and the compatibility
reference of any pending update.

<img width="650" height="293" alt="image"
src="https://github.com/user-attachments/assets/11137fbd-e6e3-4786-8234-5799965d05c6"
/>
2026-06-17 22:13:45 +01:00

42 lines
1.1 KiB
Ruby
Vendored

# frozen_string_literal: true
class RemoteThemeSerializer < ApplicationSerializer
attributes :id,
:remote_url,
:remote_version,
:local_version,
:commits_behind,
:branch,
:local_compat_ref,
:remote_compat_ref,
: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