about summary refs log tree commit diff
path: root/app/serializers/rest
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-10-13 14:42:37 +0200
committerGitHub <noreply@github.com>2022-10-13 14:42:37 +0200
commit1bd00036c284bcafb419eaf80347ba49d1b491d9 (patch)
tree4feb5850a11db2b60a56deb21101251a83247db7 /app/serializers/rest
parentb04633a9614609f18b39ba0f0015df301a04ab64 (diff)
Change about page to be mounted in the web UI (#19345)
Diffstat (limited to 'app/serializers/rest')
-rw-r--r--app/serializers/rest/domain_block_serializer.rb17
-rw-r--r--app/serializers/rest/extended_description_serializer.rb13
2 files changed, 30 insertions, 0 deletions
diff --git a/app/serializers/rest/domain_block_serializer.rb b/app/serializers/rest/domain_block_serializer.rb
new file mode 100644
index 000000000..678463e13
--- /dev/null
+++ b/app/serializers/rest/domain_block_serializer.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class REST::DomainBlockSerializer < ActiveModel::Serializer
+  attributes :domain, :digest, :severity, :comment
+
+  def domain
+    object.public_domain
+  end
+
+  def digest
+    object.domain_digest
+  end
+
+  def comment
+    object.public_comment if instance_options[:with_comment]
+  end
+end
diff --git a/app/serializers/rest/extended_description_serializer.rb b/app/serializers/rest/extended_description_serializer.rb
new file mode 100644
index 000000000..0c3649033
--- /dev/null
+++ b/app/serializers/rest/extended_description_serializer.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class REST::ExtendedDescriptionSerializer < ActiveModel::Serializer
+  attributes :updated_at, :content
+
+  def updated_at
+    object.updated_at&.iso8601
+  end
+
+  def content
+    object.text
+  end
+end