From 02ba03d6dba9e5633013e50366daabe573759168 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 4 Jan 2018 14:40:49 +0100 Subject: Send one Delete of Actor in ActivityPub when account is suspended (#6172) --- .../activitypub/delete_actor_serializer.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/serializers/activitypub/delete_actor_serializer.rb (limited to 'app/serializers') diff --git a/app/serializers/activitypub/delete_actor_serializer.rb b/app/serializers/activitypub/delete_actor_serializer.rb new file mode 100644 index 000000000..dfea9db4a --- /dev/null +++ b/app/serializers/activitypub/delete_actor_serializer.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class ActivityPub::DeleteActorSerializer < ActiveModel::Serializer + attributes :id, :type, :actor + attribute :virtual_object, key: :object + + def id + [ActivityPub::TagManager.instance.uri_for(object), '#delete'].join + end + + def type + 'Delete' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object) + end + + def virtual_object + actor + end +end -- cgit From 3c189642561f27925803448059e212718e4a2497 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Thu, 4 Jan 2018 23:36:55 +0900 Subject: Fallback default thumbnail in instance status API (#6177) --- app/helpers/routing_helper.rb | 5 +++++ app/serializers/rest/instance_serializer.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'app/serializers') diff --git a/app/helpers/routing_helper.rb b/app/helpers/routing_helper.rb index 11894a895..998b7566f 100644 --- a/app/helpers/routing_helper.rb +++ b/app/helpers/routing_helper.rb @@ -4,6 +4,7 @@ module RoutingHelper extend ActiveSupport::Concern include Rails.application.routes.url_helpers include ActionView::Helpers::AssetTagHelper + include Webpacker::Helper included do def default_url_options @@ -17,6 +18,10 @@ module RoutingHelper URI.join(root_url, source).to_s end + def full_pack_url(source, **options) + full_asset_url(asset_pack_path(source, options)) + end + private def use_storage? diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index 2898011fd..ae1dbe6b5 100644 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@ -27,7 +27,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer end def thumbnail - full_asset_url(instance_presenter.thumbnail.file.url) if instance_presenter.thumbnail + instance_presenter.thumbnail ? full_asset_url(instance_presenter.thumbnail.file.url) : full_pack_url('preview.jpg') end def stats -- cgit