Merge commit '34cd7d6585992c03298c175ab5d22ad059b58cdb' into glitch-soc/merge-upstream

Conflicts:
- `CONTRIBUTING.md`:
  Upstream changed the file, while we had a different one.
  Updated the common parts.
- `README.md`:
  Upstream changed the file, while we had a different one.
  Updated the common parts.
- `app/helpers/application_helper.rb`:
  Upstream added helpers where glitch-soc had extra ones.
  Added upstream's new helpers.
- `app/models/form/admin_settings.rb`:
  Upstream added some custom handling of one setting, while
  glitch-soc had additional code.
  Ported upstream's code.
- `lib/mastodon/version.rb`:
  Upstream moved some things to `config/mastodon.yml`.
  Did the same.
- `spec/requests/api/v1/accounts/credentials_spec.rb`:
  I don't know honestly.
This commit is contained in:
Claire
2025-01-10 20:36:25 +01:00
127 changed files with 1766 additions and 1224 deletions

View File

@@ -85,7 +85,7 @@ RSpec.describe 'credentials API' do
end
describe 'with invalid data' do
let(:params) { { note: "This is too long. #{'a' * Account::NOTE_LENGTH_LIMIT}" } }
let(:params) { { note: 'a' * 2 * Account::NOTE_LENGTH_LIMIT } }
it 'returns http unprocessable entity' do
subject

View File

@@ -29,7 +29,7 @@ RSpec.describe 'Accounts Notes API' do
end
context 'when account note exceeds allowed length', :aggregate_failures do
let(:comment) { 'a' * 2_001 }
let(:comment) { 'a' * AccountNote::COMMENT_SIZE_LIMIT * 2 }
it 'does not create account note' do
subject

View File

@@ -122,7 +122,7 @@ RSpec.describe 'Apps' do
end
context 'with a too-long name' do
let(:client_name) { 'hoge' * 20 }
let(:client_name) { 'a' * Doorkeeper::Application::APP_NAME_LIMIT * 2 }
it 'returns http unprocessable entity' do
subject
@@ -134,7 +134,7 @@ RSpec.describe 'Apps' do
end
context 'with a too-long website' do
let(:website) { "https://foo.bar/#{'hoge' * 2_000}" }
let(:website) { "https://foo.bar/#{'a' * Doorkeeper::Application::APP_WEBSITE_LIMIT * 2}" }
it 'returns http unprocessable entity' do
subject
@@ -146,7 +146,7 @@ RSpec.describe 'Apps' do
end
context 'with a too-long redirect_uri' do
let(:redirect_uris) { "https://app.example/#{'hoge' * 2_000}" }
let(:redirect_uris) { "https://app.example/#{'a' * Doorkeeper::Application::APP_REDIRECT_URI_LIMIT * 2}" }
it 'returns http unprocessable entity' do
subject

View File

@@ -33,7 +33,7 @@ RSpec.describe 'Media API', :attachment_processing do
let(:params) do
{
file: fixture_file_upload('attachment-jpg.123456_abcd', 'image/jpeg'),
description: 'aa' * MediaAttachment::MAX_DESCRIPTION_LENGTH,
description: 'a' * MediaAttachment::MAX_DESCRIPTION_LENGTH * 2,
}
end

View File

@@ -143,6 +143,55 @@ RSpec.describe 'Notifications' do
end
end
context 'when there are numerous notifications for the same final group' do
before do
user.account.notifications.destroy_all
5.times.each { FavouriteService.new.call(Fabricate(:account), user.account.statuses.first) }
end
context 'with no options' do
it 'returns a notification group covering all notifications' do
subject
notification_ids = user.account.notifications.reload.pluck(:id)
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body[:notification_groups]).to contain_exactly(
a_hash_including(
type: 'favourite',
sample_account_ids: have_attributes(size: 5),
page_min_id: notification_ids.first.to_s,
page_max_id: notification_ids.last.to_s
)
)
end
end
context 'with min_id param' do
let(:params) { { min_id: user.account.notifications.reload.first.id - 1 } }
it 'returns a notification group covering all notifications' do
subject
notification_ids = user.account.notifications.reload.pluck(:id)
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body[:notification_groups]).to contain_exactly(
a_hash_including(
type: 'favourite',
sample_account_ids: have_attributes(size: 5),
page_min_id: notification_ids.first.to_s,
page_max_id: notification_ids.last.to_s
)
)
end
end
end
context 'with no options' do
it 'returns expected notification types', :aggregate_failures do
subject