Browse Source
Merge branch 'main' into glitch-soc/merge-upstream
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/helpers/accounts_helper.rb`: Conflict due to upstream changing how followers count is displayed while we have an option to hide followers count. Ported upstream change. - `app/views/accounts/_header.html.haml`: Conflict due to upstream changing how followers count is displayed while we have an option to hide followers count. Ported upstream change. - `app/views/directories/index.html.haml`: Conflict due to upstream changing how followers count is displayed while we have an option to hide followers count. Ported upstream change.master

43 changed files with 377 additions and 154 deletions
-
4Gemfile
-
128Gemfile.lock
-
10app/controllers/activitypub/outboxes_controller.rb
-
4app/controllers/admin/resets_controller.rb
-
27app/controllers/admin/sign_in_token_authentications_controller.rb
-
2app/controllers/admin/two_factor_authentications_controller.rb
-
3app/controllers/well_known/webfinger_controller.rb
-
6app/helpers/accounts_helper.rb
-
11app/helpers/application_helper.rb
-
1app/javascript/styles/mastodon/components.scss
-
1app/models/account_stat.rb
-
25app/models/user.rb
-
8app/policies/user_policy.rb
-
4app/views/about/more.html.haml
-
4app/views/about/show.html.haml
-
10app/views/accounts/_header.html.haml
-
2app/views/accounts/show.html.haml
-
24app/views/admin/accounts/show.html.haml
-
16app/views/admin/dashboard/index.html.haml
-
4app/views/admin/follow_recommendations/_account.html.haml
-
2app/views/admin/instances/_instance.html.haml
-
2app/views/admin/tags/_tag.html.haml
-
4app/views/directories/index.html.haml
-
4app/views/relationships/_account.html.haml
-
2app/views/settings/featured_tags/index.html.haml
-
6app/views/statuses/_detailed_status.html.haml
-
42config/locales/en.yml
-
1config/routes.rb
-
5db/migrate/20210621221010_add_skip_sign_in_token_to_users.rb
-
1db/schema.rb
-
1dist/mastodon-sidekiq.service
-
1dist/mastodon-web.service
-
15lib/mastodon/accounts_cli.rb
-
13lib/mastodon/domains_cli.rb
-
6package.json
-
16spec/controllers/activitypub/outboxes_controller_spec.rb
-
2spec/controllers/admin/resets_controller_spec.rb
-
8spec/controllers/admin/two_factor_authentications_controller_spec.rb
-
4spec/controllers/well_known/webfinger_controller_spec.rb
-
2spec/models/tag_feed_spec.rb
-
28spec/models/user_spec.rb
-
33spec/services/bootstrap_timeline_service_spec.rb
-
39yarn.lock
@ -0,0 +1,27 @@ |
|||
# frozen_string_literal: true |
|||
|
|||
module Admin |
|||
class SignInTokenAuthenticationsController < BaseController |
|||
before_action :set_target_user |
|||
|
|||
def create |
|||
authorize @user, :enable_sign_in_token_auth? |
|||
@user.update(skip_sign_in_token: false) |
|||
log_action :enable_sign_in_token_auth, @user |
|||
redirect_to admin_account_path(@user.account_id) |
|||
end |
|||
|
|||
def destroy |
|||
authorize @user, :disable_sign_in_token_auth? |
|||
@user.update(skip_sign_in_token: true) |
|||
log_action :disable_sign_in_token_auth, @user |
|||
redirect_to admin_account_path(@user.account_id) |
|||
end |
|||
|
|||
private |
|||
|
|||
def set_target_user |
|||
@user = User.find(params[:user_id]) |
|||
end |
|||
end |
|||
end |
@ -0,0 +1,5 @@ |
|||
class AddSkipSignInTokenToUsers < ActiveRecord::Migration[6.1] |
|||
def change |
|||
add_column :users, :skip_sign_in_token, :boolean |
|||
end |
|||
end |
@ -1,4 +1,37 @@ |
|||
require 'rails_helper' |
|||
|
|||
RSpec.describe BootstrapTimelineService, type: :service do |
|||
subject { BootstrapTimelineService.new } |
|||
|
|||
context 'when the new user has registered from an invite' do |
|||
let(:service) { double } |
|||
let(:autofollow) { false } |
|||
let(:inviter) { Fabricate(:user, confirmed_at: 2.days.ago) } |
|||
let(:invite) { Fabricate(:invite, user: inviter, max_uses: nil, expires_at: 1.hour.from_now, autofollow: autofollow) } |
|||
let(:new_user) { Fabricate(:user, invite_code: invite.code) } |
|||
|
|||
before do |
|||
allow(FollowService).to receive(:new).and_return(service) |
|||
allow(service).to receive(:call) |
|||
end |
|||
|
|||
context 'when the invite has auto-follow enabled' do |
|||
let(:autofollow) { true } |
|||
|
|||
it 'calls FollowService to follow the inviter' do |
|||
subject.call(new_user.account) |
|||
expect(service).to have_received(:call).with(new_user.account, inviter.account) |
|||
end |
|||
end |
|||
|
|||
context 'when the invite does not have auto-follow enable' do |
|||
let(:autofollow) { false } |
|||
|
|||
it 'calls FollowService to follow the inviter' do |
|||
subject.call(new_user.account) |
|||
expect(service).to_not have_received(:call) |
|||
end |
|||
end |
|||
|
|||
end |
|||
end |
Write
Preview
Loading…
Cancel
Save
Reference in new issue