summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-03-14 05:28:30 +0100
committerGitHub <noreply@github.com>2019-03-14 05:28:30 +0100
commit51e154f5e87968d6bb115e053689767ab33e80cd (patch)
treed86ba475bfc61ba7a774bf36e24704dc82f68991
parent6e3936aa6f4296ac202b54c0b178b4fa825d7885 (diff)
Admission-based registrations mode (#10250)
Fix #6856 Fix #6951
-rw-r--r--app/controllers/accounts_controller.rb4
-rw-r--r--app/controllers/admin/accounts_controller.rb17
-rw-r--r--app/controllers/admin/dashboard_controller.rb2
-rw-r--r--app/controllers/admin/settings_controller.rb3
-rw-r--r--app/controllers/api/base_controller.rb4
-rw-r--r--app/controllers/api/v1/accounts_controller.rb6
-rw-r--r--app/controllers/auth/registrations_controller.rb2
-rw-r--r--app/controllers/concerns/account_controller_concern.rb14
-rw-r--r--app/helpers/admin/filter_helper.rb2
-rw-r--r--app/helpers/application_helper.rb18
-rw-r--r--app/helpers/home_helper.rb10
-rw-r--r--app/javascript/styles/mastodon/admin.scss8
-rw-r--r--app/mailers/admin_mailer.rb10
-rw-r--r--app/models/account.rb2
-rw-r--r--app/models/account_filter.rb4
-rw-r--r--app/models/form/admin_settings.rb4
-rw-r--r--app/models/user.rb42
-rw-r--r--app/policies/user_policy.rb10
-rw-r--r--app/presenters/instance_presenter.rb2
-rw-r--r--app/serializers/rest/instance_serializer.rb2
-rw-r--r--app/services/app_sign_up_service.rb2
-rw-r--r--app/views/about/_registration.html.haml12
-rw-r--r--app/views/admin/accounts/_account.html.haml10
-rw-r--r--app/views/admin/accounts/index.html.haml7
-rw-r--r--app/views/admin/accounts/show.html.haml16
-rw-r--r--app/views/admin/settings/edit.html.haml10
-rw-r--r--app/views/admin_mailer/new_pending_account.text.erb8
-rw-r--r--app/views/auth/registrations/new.html.haml2
-rw-r--r--app/views/auth/shared/_links.html.haml2
-rw-r--r--app/views/layouts/public.html.haml5
-rw-r--r--app/views/remote_follow/new.html.haml2
-rw-r--r--app/views/remote_interaction/new.html.haml2
-rw-r--r--app/views/user_mailer/confirmation_instructions.html.haml2
-rw-r--r--app/views/user_mailer/confirmation_instructions.text.erb2
-rw-r--r--config/locales/ar.yml3
-rw-r--r--config/locales/ca.yml3
-rw-r--r--config/locales/co.yml3
-rw-r--r--config/locales/cs.yml3
-rw-r--r--config/locales/cy.yml3
-rw-r--r--config/locales/da.yml3
-rw-r--r--config/locales/de.yml3
-rw-r--r--config/locales/devise.en.yml3
-rw-r--r--config/locales/el.yml3
-rw-r--r--config/locales/en.yml17
-rw-r--r--config/locales/eo.yml3
-rw-r--r--config/locales/es.yml3
-rw-r--r--config/locales/eu.yml3
-rw-r--r--config/locales/fa.yml3
-rw-r--r--config/locales/fi.yml3
-rw-r--r--config/locales/fr.yml3
-rw-r--r--config/locales/gl.yml3
-rw-r--r--config/locales/he.yml2
-rw-r--r--config/locales/hu.yml3
-rw-r--r--config/locales/id.yml2
-rw-r--r--config/locales/io.yml2
-rw-r--r--config/locales/it.yml3
-rw-r--r--config/locales/ja.yml3
-rw-r--r--config/locales/ka.yml3
-rw-r--r--config/locales/kk.yml3
-rw-r--r--config/locales/ko.yml3
-rw-r--r--config/locales/lt.yml3
-rw-r--r--config/locales/nl.yml3
-rw-r--r--config/locales/no.yml3
-rw-r--r--config/locales/oc.yml3
-rw-r--r--config/locales/pl.yml3
-rw-r--r--config/locales/pt-BR.yml3
-rw-r--r--config/locales/pt.yml3
-rw-r--r--config/locales/ru.yml3
-rw-r--r--config/locales/sk.yml3
-rw-r--r--config/locales/sq.yml3
-rw-r--r--config/locales/sr-Latn.yml3
-rw-r--r--config/locales/sr.yml3
-rw-r--r--config/locales/sv.yml3
-rw-r--r--config/locales/th.yml2
-rw-r--r--config/locales/tr.yml2
-rw-r--r--config/locales/uk.yml3
-rw-r--r--config/locales/zh-CN.yml3
-rw-r--r--config/locales/zh-HK.yml3
-rw-r--r--config/locales/zh-TW.yml3
-rw-r--r--config/routes.rb2
-rw-r--r--config/settings.yml2
-rw-r--r--db/migrate/20190307234537_add_approved_to_users.rb23
-rw-r--r--db/schema.rb16
-rw-r--r--db/seeds.rb2
-rw-r--r--lib/mastodon/settings_cli.rb4
-rw-r--r--spec/controllers/accounts_controller_spec.rb2
-rw-r--r--spec/controllers/admin/settings_controller_spec.rb16
-rw-r--r--spec/controllers/auth/registrations_controller_spec.rb20
-rw-r--r--spec/controllers/concerns/account_controller_concern_spec.rb16
-rw-r--r--spec/helpers/application_helper_spec.rb4
-rw-r--r--spec/presenters/instance_presenter_spec.rb28
-rw-r--r--spec/services/app_sign_up_service_spec.rb4
92 files changed, 282 insertions, 249 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index dfbe5bffcf3..a3410c1efec 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -89,8 +89,8 @@ class AccountsController < ApplicationController
end
end
- def set_account
- @account = Account.find_local!(params[:username])
+ def username_param
+ params[:username]
end
def older_url
diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb
index 562fba9960d..e160c603a82 100644
--- a/app/controllers/admin/accounts_controller.rb
+++ b/app/controllers/admin/accounts_controller.rb
@@ -2,9 +2,9 @@
module Admin
class AccountsController < BaseController
- before_action :set_account, only: [:show, :subscribe, :unsubscribe, :redownload, :remove_avatar, :remove_header, :enable, :unsilence, :unsuspend, :memorialize]
+ before_action :set_account, only: [:show, :subscribe, :unsubscribe, :redownload, :remove_avatar, :remove_header, :enable, :unsilence, :unsuspend, :memorialize, :approve, :reject]
before_action :require_remote_account!, only: [:subscribe, :unsubscribe, :redownload]
- before_action :require_local_account!, only: [:enable, :memorialize]
+ before_action :require_local_account!, only: [:enable, :memorialize, :approve, :reject]
def index
authorize :account, :index?
@@ -45,6 +45,18 @@ module Admin
redirect_to admin_account_path(@account.id)
end
+ def approve
+ authorize @account.user, :approve?
+ @account.user.approve!
+ redirect_to admin_accounts_path(pending: '1')
+ end
+
+ def reject
+ authorize @account.user, :reject?
+ SuspendAccountService.new.call(@account, including_user: true, destroy: true)
+ redirect_to