mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
Enable missing before actions in Collection API (#37122)
This commit is contained in:
@@ -9,9 +9,9 @@ class Api::V1Alpha::CollectionsController < Api::BaseController
|
|||||||
|
|
||||||
before_action :check_feature_enabled
|
before_action :check_feature_enabled
|
||||||
|
|
||||||
before_action -> { doorkeeper_authorize! :write, :'write:collections' }, only: [:create]
|
before_action -> { doorkeeper_authorize! :write, :'write:collections' }, only: [:create, :update, :destroy]
|
||||||
|
|
||||||
before_action :require_user!, only: [:create]
|
before_action :require_user!, only: [:create, :update, :destroy]
|
||||||
|
|
||||||
before_action :set_collection, only: [:show, :update, :destroy]
|
before_action :set_collection, only: [:show, :update, :destroy]
|
||||||
|
|
||||||
|
|||||||
@@ -104,8 +104,6 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
|
|||||||
let(:collection) { Fabricate(:collection) }
|
let(:collection) { Fabricate(:collection) }
|
||||||
let(:params) { {} }
|
let(:params) { {} }
|
||||||
|
|
||||||
it_behaves_like 'forbidden for wrong scope', 'read:collections'
|
|
||||||
|
|
||||||
context 'when user is not owner' do
|
context 'when user is not owner' do
|
||||||
it 'returns http forbidden' do
|
it 'returns http forbidden' do
|
||||||
subject
|
subject
|
||||||
@@ -124,6 +122,8 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
|
|||||||
discoverable: false)
|
discoverable: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'forbidden for wrong scope', 'read:collections'
|
||||||
|
|
||||||
context 'with valid params' do
|
context 'with valid params' do
|
||||||
let(:params) do
|
let(:params) do
|
||||||
{
|
{
|
||||||
@@ -172,8 +172,6 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
|
|||||||
|
|
||||||
let(:collection) { Fabricate(:collection) }
|
let(:collection) { Fabricate(:collection) }
|
||||||
|
|
||||||
it_behaves_like 'forbidden for wrong scope', 'read:collections'
|
|
||||||
|
|
||||||
context 'when user is not owner' do
|
context 'when user is not owner' do
|
||||||
it 'returns http forbidden' do
|
it 'returns http forbidden' do
|
||||||
subject
|
subject
|
||||||
@@ -185,6 +183,8 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
|
|||||||
context 'when user is the owner' do
|
context 'when user is the owner' do
|
||||||
let(:collection) { Fabricate(:collection, account: user.account) }
|
let(:collection) { Fabricate(:collection, account: user.account) }
|
||||||
|
|
||||||
|
it_behaves_like 'forbidden for wrong scope', 'read:collections'
|
||||||
|
|
||||||
it 'deletes the collection and returns http success' do
|
it 'deletes the collection and returns http success' do
|
||||||
collection
|
collection
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user