Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/api/v1/statuses_controller.rb`: Upstream moved things around in a place where glitch-soc had support for an extra parameter (`content_type`). Follow upstream but reintroduce `content_type`.
This commit is contained in:
		@@ -110,21 +110,24 @@ RSpec.describe Api::V1::MediaController, type: :controller do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when not attached to a status' do
 | 
			
		||||
      let(:media) { Fabricate(:media_attachment, status: nil, account: user.account) }
 | 
			
		||||
    context 'when the author \'s' do
 | 
			
		||||
      let(:status) { nil }
 | 
			
		||||
      let(:media)  { Fabricate(:media_attachment, status: status, account: user.account) }
 | 
			
		||||
 | 
			
		||||
      before do
 | 
			
		||||
        put :update, params: { id: media.id, description: 'Lorem ipsum!!!' }
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'updates the description' do
 | 
			
		||||
        put :update, params: { id: media.id, description: 'Lorem ipsum!!!' }
 | 
			
		||||
        expect(media.reload.description).to eq 'Lorem ipsum!!!'
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when attached to a status' do
 | 
			
		||||
      let(:media) { Fabricate(:media_attachment, status: Fabricate(:status), account: user.account) }
 | 
			
		||||
      context 'when already attached to a status' do
 | 
			
		||||
        let(:status) { Fabricate(:status, account: user.account) }
 | 
			
		||||
 | 
			
		||||
      it 'returns http not found' do
 | 
			
		||||
        put :update, params: { id: media.id, description: 'Lorem ipsum!!!' }
 | 
			
		||||
        expect(response).to have_http_status(:not_found)
 | 
			
		||||
        it 'returns http not found' do
 | 
			
		||||
          expect(response).to have_http_status(:not_found)
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -102,6 +102,23 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
 | 
			
		||||
        expect(Status.find_by(id: status.id)).to be nil
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    describe 'PUT #update' do
 | 
			
		||||
      let(:scopes) { 'write:statuses' }
 | 
			
		||||
      let(:status) { Fabricate(:status, account: user.account) }
 | 
			
		||||
 | 
			
		||||
      before do
 | 
			
		||||
        put :update, params: { id: status.id, status: 'I am updated' }
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'returns http success' do
 | 
			
		||||
        expect(response).to have_http_status(200)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'updates the status' do
 | 
			
		||||
        expect(status.reload.text).to eq 'I am updated'
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'without an oauth token' do
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user