diff options
author | Starfall <us@starfall.systems> | 2022-06-06 14:06:41 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2022-06-06 14:06:41 -0500 |
commit | 6e1ebaca0d241d3e9047382e47d7b7136bc4d404 (patch) | |
tree | 4257f127bd9f10897182914602b31b1ecef401f7 /app/serializers | |
parent | bd872c93333b90f85d90bc60f5690537bee15ee2 (diff) | |
parent | 3d841eba69b340aac4f012fb388f9e9761ec2ba5 (diff) |
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/nodeinfo/serializer.rb | 6 | ||||
-rw-r--r-- | app/serializers/rest/admin/domain_block_serializer.rb | 11 | ||||
-rw-r--r-- | app/serializers/rest/admin/existing_domain_block_error_serializer.rb | 15 |
3 files changed, 31 insertions, 1 deletions
diff --git a/app/serializers/nodeinfo/serializer.rb b/app/serializers/nodeinfo/serializer.rb index 7ff8aabec..afae7f00a 100644 --- a/app/serializers/nodeinfo/serializer.rb +++ b/app/serializers/nodeinfo/serializer.rb @@ -3,7 +3,7 @@ class NodeInfo::Serializer < ActiveModel::Serializer include RoutingHelper - attributes :version, :software, :protocols, :usage, :open_registrations + attributes :version, :software, :protocols, :services, :usage, :open_registrations, :metadata def version '2.0' @@ -37,6 +37,10 @@ class NodeInfo::Serializer < ActiveModel::Serializer Setting.registrations_mode != 'none' && !Rails.configuration.x.single_user_mode end + def metadata + [] + end + private def instance_presenter diff --git a/app/serializers/rest/admin/domain_block_serializer.rb b/app/serializers/rest/admin/domain_block_serializer.rb new file mode 100644 index 000000000..b955d008a --- /dev/null +++ b/app/serializers/rest/admin/domain_block_serializer.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class REST::Admin::DomainBlockSerializer < ActiveModel::Serializer + attributes :id, :domain, :created_at, :severity, + :reject_media, :reject_reports, + :private_comment, :public_comment, :obfuscate + + def id + object.id.to_s + end +end diff --git a/app/serializers/rest/admin/existing_domain_block_error_serializer.rb b/app/serializers/rest/admin/existing_domain_block_error_serializer.rb new file mode 100644 index 000000000..629566dad --- /dev/null +++ b/app/serializers/rest/admin/existing_domain_block_error_serializer.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class REST::Admin::ExistingDomainBlockErrorSerializer < ActiveModel::Serializer + attributes :error + + has_one :existing_domain_block, serializer: REST::Admin::DomainBlockSerializer + + def error + I18n.t('admin.domain_blocks.existing_domain_block', name: existing_domain_block.domain) + end + + def existing_domain_block + object + end +end |