Merge commit 'c44cc1f5c3bafb49a324f8f72a42a91d09eecfe3' into glitch-soc/merge-upstream
This commit is contained in:
commit
e451416d90
114 files changed
+848
-249
No files matched your search
@@ -27,7 +27,7 @@ class Api::V1Alpha::CollectionItemsController < Api::BaseController
|
||||
def destroy
|
||||
authorize @collection, :update?
|
||||
|
||||
@collection_item.destroy
|
||||
DeleteCollectionItemService.new.call(@collection_item)
|
||||
|
||||
head 200
|
||||
end
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CollectionItemsController < ApplicationController
|
||||
include SignatureAuthentication
|
||||
include Authorization
|
||||
include AccountOwnedConcern
|
||||
|
||||
vary_by -> { public_fetch_mode? ? 'Accept, Accept-Language, Cookie' : 'Accept, Accept-Language, Cookie, Signature' }
|
||||
|
||||
before_action :check_feature_enabled
|
||||
before_action :require_account_signature!, if: -> { authorized_fetch_mode? }
|
||||
before_action :set_collection_item
|
||||
|
||||
skip_around_action :set_locale
|
||||
skip_before_action :require_functional!, unless: :limited_federation_mode?
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
expires_in(3.minutes, public: public_fetch_mode?)
|
||||
|
||||
render json: @collection_item,
|
||||
serializer: ActivityPub::FeaturedItemSerializer,
|
||||
adapter: ActivityPub::Adapter,
|
||||
content_type: 'application/activity+json'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_collection_item
|
||||
@collection_item = @account.curated_collection_items.find(params[:id])
|
||||
authorize @collection_item.collection, :show?
|
||||
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError
|
||||
not_found
|
||||
end
|
||||
|
||||
def check_feature_enabled
|
||||
raise ActionController::RoutingError unless Mastodon::Feature.collections_enabled?
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user