about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorOSAMU SATO <satosamu@gmail.com>2020-10-13 08:01:14 +0900
committerGitHub <noreply@github.com>2020-10-13 01:01:14 +0200
commit96761752eccfc0d239974a24e0cc2d74c6aee7ac (patch)
tree1590275b4f8a1f954d90e870ef2bfb8ac00d7109 /app/serializers
parentf54ca3d08e068af07a5b7a8b139e7658b3236db8 (diff)
Add duration parameter to muting. (#13831)
* Adding duration to muting.

* Remove useless checks
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/rest/muted_account_serializer.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/serializers/rest/muted_account_serializer.rb b/app/serializers/rest/muted_account_serializer.rb
new file mode 100644
index 000000000..3ddd706dc
--- /dev/null
+++ b/app/serializers/rest/muted_account_serializer.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class REST::MutedAccountSerializer < REST::AccountSerializer
+  attribute :mute_expires_at
+
+  def mute_expires_at
+    mute = current_user.account.mute_relationships.find_by(target_account_id: object.id)
+    mute && !mute.expired? ? mute.expires_at : nil
+  end
+end