Merge branch 'main' into glitch-soc/merge-upstream

Conflicts:
- `.prettierignore`:
  Upstream added a line at the end of the file, while glitch-soc had its own
  extra lines.
  Took upstream's change.
- `CONTRIBUTING.md`:
  We have our custom CONTRIBUTING.md quoting upstream. Upstream made changes.
  Ported upstream changes.
- `app/controllers/application_controller.rb`:
  Upstream made code style changes in a method that is entirely replaced
  in glitch-soc.
  Ignored the change.
- `app/models/account.rb`:
  Code style changes textually close to glitch-soc-specific changes.
  Ported upstream changes.
- `lib/sanitize_ext/sanitize_config.rb`:
  Upstream code style changes.
  Ignored them.
This commit is contained in:
Claire
2023-02-25 14:00:40 +01:00
946 changed files with 4147 additions and 3072 deletions

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::ApplicationsController do
@@ -32,7 +34,7 @@ describe Settings::ApplicationsController do
app.update!(owner: nil)
get :show, params: { id: app.id }
expect(response.status).to eq 404
expect(response).to have_http_status 404
end
end
@@ -73,7 +75,7 @@ describe Settings::ApplicationsController do
name: 'My New App',
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
website: 'http://google.com',
scopes: ['read', 'write', 'follow'],
scopes: %w(read write follow),
},
}
response

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::DeletesController do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::Exports::BlockedAccountsController do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::Exports::BookmarksController do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::Exports::FollowingAccountsController do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::Exports::MutedAccountsController do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::FeaturedTagsController do
@@ -5,7 +7,7 @@ describe Settings::FeaturedTagsController do
shared_examples 'authenticate user' do
it 'redirects to sign_in page' do
is_expected.to redirect_to new_user_session_path
expect(subject).to redirect_to new_user_session_path
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Settings::ImportsController, type: :controller do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::MigrationsController do
@@ -5,7 +7,7 @@ describe Settings::MigrationsController do
shared_examples 'authenticate user' do
it 'redirects to sign_in page' do
is_expected.to redirect_to new_user_session_path
expect(subject).to redirect_to new_user_session_path
end
end
@@ -27,8 +29,8 @@ describe Settings::MigrationsController do
let(:moved_to_account) { nil }
it 'renders show page' do
is_expected.to have_http_status 200
is_expected.to render_template :show
expect(subject).to have_http_status 200
expect(subject).to render_template :show
end
end
@@ -36,8 +38,8 @@ describe Settings::MigrationsController do
let(:moved_to_account) { Fabricate(:account) }
it 'renders show page' do
is_expected.to have_http_status 200
is_expected.to render_template :show
expect(subject).to have_http_status 200
expect(subject).to render_template :show
end
end
end
@@ -61,7 +63,7 @@ describe Settings::MigrationsController do
let(:acct) { Fabricate(:account, also_known_as: [ActivityPub::TagManager.instance.uri_for(user.account)]) }
it 'updates moved to account' do
is_expected.to redirect_to settings_migration_path
expect(subject).to redirect_to settings_migration_path
expect(user.account.reload.moved_to_account_id).to eq acct.id
end
end
@@ -70,7 +72,7 @@ describe Settings::MigrationsController do
let(:acct) { user.account }
it 'renders show' do
is_expected.to render_template :show
expect(subject).to render_template :show
end
it 'does not update the moved account' do
@@ -82,7 +84,7 @@ describe Settings::MigrationsController do
let(:acct) { Fabricate(:account, also_known_as: []) }
it 'renders show' do
is_expected.to render_template :show
expect(subject).to render_template :show
end
it 'does not update the moved account' do
@@ -99,7 +101,7 @@ describe Settings::MigrationsController do
end
it 'renders show' do
is_expected.to render_template :show
expect(subject).to render_template :show
end
it 'does not update the moved account' do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::Preferences::NotificationsController do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::Preferences::OtherController do
@@ -23,7 +25,7 @@ describe Settings::Preferences::OtherController do
expect(response).to redirect_to(settings_preferences_other_path)
user.reload
expect(user.locale).to eq 'en'
expect(user.chosen_languages).to eq ['es', 'fr']
expect(user.chosen_languages).to eq %w(es fr)
end
it 'updates user settings' do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Settings::ProfilesController, type: :controller do
@@ -38,7 +40,7 @@ RSpec.describe Settings::ProfilesController, type: :controller do
put :update, params: { account: { avatar: fixture_file_upload('avatar.gif', 'image/gif') } }
expect(response).to redirect_to(settings_profile_path)
expect(account.reload.avatar.instance.avatar_file_name).not_to be_nil
expect(account.reload.avatar.instance.avatar_file_name).to_not be_nil
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe Settings::SessionsController do
@@ -15,7 +17,7 @@ describe Settings::SessionsController do
let(:id) { session_activation.id }
it 'destroys session activation' do
is_expected.to redirect_to edit_user_registration_path
expect(subject).to redirect_to edit_user_registration_path
expect(SessionActivation.find_by(id: id)).to be_nil
end
end
@@ -24,7 +26,7 @@ describe Settings::SessionsController do
let(:id) { session_activation.id + 1000 }
it 'destroys session activation' do
is_expected.to have_http_status :not_found
expect(subject).to have_http_status 404
end
end
end

View File

@@ -140,7 +140,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
it 'includes existing credentials in list of excluded credentials' do
get :options
excluded_credentials_ids = JSON.parse(response.body)['excludeCredentials'].map { |credential| credential['id'] }
excluded_credentials_ids = JSON.parse(response.body)['excludeCredentials'].pluck('id')
expect(excluded_credentials_ids).to match_array(user.webauthn_credentials.pluck(:external_id))
end
end