Merge commit '425d77f8124a50fc033e8fb3bdf7b89a6a25f4fa' into glitch-soc/merge-upstream

Conflicts:
- `.rubocop_todo.yml`:
  Upstream regenerated this file, glitch-soc had a specific ignore.
- `README.md`:
  Upstream updated its README, but glitch-soc has a completely different one.
  Kept glitch-soc's README
This commit is contained in:
Claire
2023-08-11 22:15:41 +02:00
130 changed files with 1818 additions and 1188 deletions

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AccountAlias do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AccountDeletionRequest do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AccountModerationNote do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AnnouncementMute do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AnnouncementReaction do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Announcement do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Backup do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ConversationMute do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe CustomFilterKeyword do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe CustomFilter do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Device do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe EncryptedMessage do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe FeaturedTag do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe FollowRecommendationSuppression do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ListAccount do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe List do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe LoginActivity do
end

View File

@@ -84,7 +84,87 @@ RSpec.describe MediaAttachment, paperclip_processing: true do
end
end
describe 'animated gif conversion' do
shared_examples 'static 600x400 image' do |content_type, extension|
after do
media.destroy
end
it 'saves media attachment' do
expect(media.persisted?).to be true
expect(media.file).to_not be_nil
end
it 'completes processing' do
expect(media.processing_complete?).to be true
end
it 'sets type' do
expect(media.type).to eq 'image'
end
it 'sets content type' do
expect(media.file_content_type).to eq content_type
end
it 'sets file extension' do
expect(media.file_file_name).to end_with extension
end
it 'strips original file name' do
expect(media.file_file_name).to_not start_with '600x400'
end
it 'sets meta for original' do
expect(media.file.meta['original']['width']).to eq 600
expect(media.file.meta['original']['height']).to eq 400
expect(media.file.meta['original']['aspect']).to eq 1.5
end
it 'sets meta for thumbnail' do
expect(media.file.meta['small']['width']).to eq 588
expect(media.file.meta['small']['height']).to eq 392
expect(media.file.meta['small']['aspect']).to eq 1.5
end
end
describe 'jpeg' do
let(:media) { described_class.create(account: Fabricate(:account), file: attachment_fixture('600x400.jpeg')) }
it_behaves_like 'static 600x400 image', 'image/jpeg', '.jpeg'
end
describe 'png' do
let(:media) { described_class.create(account: Fabricate(:account), file: attachment_fixture('600x400.png')) }
it_behaves_like 'static 600x400 image', 'image/png', '.png'
end
describe 'webp' do
let(:media) { described_class.create(account: Fabricate(:account), file: attachment_fixture('600x400.webp')) }
it_behaves_like 'static 600x400 image', 'image/webp', '.webp'
end
describe 'avif' do
let(:media) { described_class.create(account: Fabricate(:account), file: attachment_fixture('600x400.avif')) }
it_behaves_like 'static 600x400 image', 'image/jpeg', '.jpeg'
end
describe 'heic' do
let(:media) { described_class.create(account: Fabricate(:account), file: attachment_fixture('600x400.heic')) }
it_behaves_like 'static 600x400 image', 'image/jpeg', '.jpeg'
end
describe 'base64-encoded image' do
let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('600x400.jpeg').read)}" }
let(:media) { described_class.create(account: Fabricate(:account), file: base64_attachment) }
it_behaves_like 'static 600x400 image', 'image/jpeg', '.jpeg'
end
describe 'animated gif' do
let(:media) { described_class.create(account: Fabricate(:account), file: attachment_fixture('avatar.gif')) }
it 'sets type to gifv' do
@@ -101,7 +181,7 @@ RSpec.describe MediaAttachment, paperclip_processing: true do
end
end
describe 'non-animated gif non-conversion' do
describe 'static gif' do
fixtures = [
{ filename: 'attachment.gif', width: 600, height: 400, aspect: 1.5 },
{ filename: 'mini-static.gif', width: 32, height: 32, aspect: 1.0 },
@@ -172,37 +252,6 @@ RSpec.describe MediaAttachment, paperclip_processing: true do
end
end
describe 'jpeg' do
let(:media) { described_class.create(account: Fabricate(:account), file: attachment_fixture('attachment.jpg')) }
it 'sets meta for different style' do
expect(media.file.meta['original']['width']).to eq 600
expect(media.file.meta['original']['height']).to eq 400
expect(media.file.meta['original']['aspect']).to eq 1.5
expect(media.file.meta['small']['width']).to eq 588
expect(media.file.meta['small']['height']).to eq 392
expect(media.file.meta['small']['aspect']).to eq 1.5
end
it 'gives the file a random name' do
expect(media.file_file_name).to_not eq 'attachment.jpg'
end
end
describe 'base64-encoded jpeg' do
let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
let(:media) { described_class.create(account: Fabricate(:account), file: base64_attachment) }
it 'saves media attachment' do
expect(media.persisted?).to be true
expect(media.file).to_not be_nil
end
it 'gives the file a file name' do
expect(media.file_file_name).to_not be_blank
end
end
it 'is invalid without file' do
media = described_class.new(account: Fabricate(:account))
expect(media.valid?).to be false

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Mute do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe PreviewCard do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe PreviewCardTrend do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Relay do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ScheduledStatus do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe StatusStat do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe StatusTrend do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe SystemKey do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe TagFollow do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe UnavailableDomain do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe UserInviteRequest do
end

View File

@@ -1,6 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Web::Setting do
end