about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-04-09 16:06:30 +0200
committerYamagishi Kazutoshi <ykzts@desire.sh>2019-04-09 23:06:30 +0900
commit8b69a66380bbe32127e717ca2d79244392b7d2b6 (patch)
tree3362aba467a4f40e108f38aa7bf4e76ba48df942
parent0f3719f16fb5a2704416fa3afae00ba767ad2b2c (diff)
Add "why do you want to join" field to invite requests (#10524)
* Add "why do you want to join" field to invite requests

Fix #10512

* Remove unused translations

* Fix broken registrations when no invite request text is submitted
-rw-r--r--app/controllers/about_controller.rb5
-rw-r--r--app/controllers/admin/pending_accounts_controller.rb2
-rw-r--r--app/controllers/auth/registrations_controller.rb14
-rw-r--r--app/javascript/styles/mastodon/accounts.scss26
-rw-r--r--app/javascript/styles/mastodon/widgets.scss9
-rw-r--r--app/models/user.rb3
-rw-r--r--app/models/user_invite_request.rb17
-rw-r--r--app/views/about/_registration.html.haml5
-rw-r--r--app/views/admin/pending_accounts/_account.html.haml22
-rw-r--r--app/views/auth/registrations/new.html.haml9
-rw-r--r--config/locales/ar.yml1
-rw-r--r--config/locales/ast.yml1
-rw-r--r--config/locales/ca.yml1
-rw-r--r--config/locales/co.yml1
-rw-r--r--config/locales/cs.yml1
-rw-r--r--config/locales/cy.yml1
-rw-r--r--config/locales/da.yml1
-rw-r--r--config/locales/de.yml1
-rw-r--r--config/locales/el.yml1
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/locales/en_GB.yml1
-rw-r--r--config/locales/eo.yml1
-rw-r--r--config/locales/es.yml1
-rw-r--r--config/locales/eu.yml1
-rw-r--r--config/locales/fa.yml1
-rw-r--r--config/locales/fi.yml1
-rw-r--r--config/locales/fr.yml1
-rw-r--r--config/locales/gl.yml1
-rw-r--r--config/locales/hu.yml1
-rw-r--r--config/locales/it.yml1
-rw-r--r--config/locales/ja.yml1
-rw-r--r--config/locales/ka.yml1
-rw-r--r--config/locales/kk.yml1
-rw-r--r--config/locales/ko.yml1
-rw-r--r--config/locales/lt.yml1
-rw-r--r--config/locales/nl.yml1
-rw-r--r--config/locales/no.yml1
-rw-r--r--config/locales/oc.yml1
-rw-r--r--config/locales/pl.yml1
-rw-r--r--config/locales/pt-BR.yml1
-rw-r--r--config/locales/pt.yml1
-rw-r--r--config/locales/ro.yml1
-rw-r--r--config/locales/ru.yml1
-rw-r--r--config/locales/simple_form.en.yml4
-rw-r--r--config/locales/sk.yml1
-rw-r--r--config/locales/sq.yml1
-rw-r--r--config/locales/sr-Latn.yml1
-rw-r--r--config/locales/sr.yml1
-rw-r--r--config/locales/sv.yml1
-rw-r--r--config/locales/uk.yml1
-rw-r--r--config/locales/zh-CN.yml1
-rw-r--r--config/locales/zh-HK.yml1
-rw-r--r--config/locales/zh-TW.yml1
-rw-r--r--db/migrate/20190409054914_create_user_invite_requests.rb10
-rw-r--r--db/schema.rb11
-rw-r--r--spec/fabricators/user_invite_request_fabricator.rb4
-rw-r--r--spec/models/user_invite_request_spec.rb4
57 files changed, 125 insertions, 62 deletions
diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb
index 67bb2c87f..52a51fd62 100644
--- a/app/controllers/about_controller.rb
+++ b/app/controllers/about_controller.rb
@@ -16,7 +16,10 @@ class AboutController < ApplicationController
   private
 
   def new_user
-    User.new.tap(&:build_account)
+    User.new.tap do |user|
+      user.build_account
+      user.build_invite_request
+    end
   end
 
   helper_method :new_user
diff --git a/app/controllers/admin/pending_accounts_controller.rb b/app/controllers/admin/pending_accounts_controller.rb
index 2ea7785fc..249525504 100644
--- a/app/controllers/admin/pending_accounts_controller.rb
+++ b/app/controllers/admin/pending_accounts_controller.rb
@@ -30,7 +30,7 @@ module Admin
     private
 
     def set_accounts
-      @accounts = Account.joins(:user).merge(User.pending).page(params[:page])
+      @accounts = Account.joins(:user).merge(User.pending).includes(user: :invite_request).page(params[:page])
     end
 
     def form_account_batch_params
diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb
index 16a3ec67a..5c1ff769a 100644
--- a/app/controllers/auth/registrations_controller.rb
+++ b/app/controllers/auth/registrations_controller.rb
@@ -10,6 +10,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController
   before_action :set_instance_presenter, only: [:new, :create, :update]
   before_action :set_body_classes, only: [:new, :create, :edit, :update]
 
+  def new
+    super(&:build_invite_request)
+  end
+
   def destroy
     not_found
   end
@@ -24,17 +28,17 @@ class Auth::RegistrationsController < Devise::RegistrationsController
   def build_resource(hash = nil)
     super(hash)
 
-    resource.locale      = I18n.locale
-    resource.invite_code = params[:invite_code] if resource.invite_code.blank?
-    resource.agreement   = true
+    resource.locale             = I18n.locale
+    resource.invite_code        = params[:invite_code] if resource.invite_code.blank?
+    resource.agreement          = true
+    resource.current_sign_in_ip = request.remote_ip
 
-    resource.current_sign_in_ip = request.remote_ip if resource.current_sign_in_ip.nil?
     resource.build_account if resource.account.nil?
   end
 
   def configure_sign_up_params
     devise_parameter_sanitizer.permit(:sign_up) do |u|
-      u.permit({ account_attributes: [:username] }, :email, :password, :password_confirmation, :invite_code)
+      u.permit({ account_attributes: [:username], invite_request_attributes: [:text] }, :email, :password, :password_confirmation, :invite_code)
     end
   end
 
diff --git a/app/javascript/styles/mastodon/accounts.scss b/app/javascript/styles/mastodon/accounts.scss
index f4f458cf4..a790251f4 100644
--- a/app/javascript/styles/mastodon/accounts.scss
+++ b/app/javascript/styles/mastodon/accounts.scss
@@ -292,3 +292,29 @@
 .directory__tag .trends__item__current {
   width: auto;
 }
+
+.pending-account {
+  &__header {
+    color: $darker-text-color;
+
+    a {
+      color: $ui-secondary-color;
+      text-decoration: none;
+
+      &:hover,
+      &:active,
+      &:focus {
+        text-decoration: underline;
+      }
+    }
+
+    strong {
+      color: $primary-text-color;
+      font-weight: 700;
+    }
+  }
+
+  &__body {
+    margin-top: 10px;
+  }
+}
diff --git a/app/javascript/styles/mastodon/widgets.scss b/app/javascript/styles/mastodon/widgets.scss
index 307e509d5..e736d7a7e 100644
--- a/app/javascript/styles/mastodon/widgets.scss
+++ b/app/javascript/styles/mastodon/widgets.scss
@@ -377,6 +377,10 @@
     border: 0;
   }
 
+  strong {
+    font-weight: 700;
+  }
+
   thead th {
     text-align: center;
     text-transform: uppercase;
@@ -414,6 +418,11 @@
     }
   }
 
+  &__comment {
+    width: 50%;
+    vertical-align: initial !important;
+  }
+
   @media screen and (max-width: $no-gap-breakpoint) {
     tbody td.optional {
       display: none;
diff --git a/app/models/user.rb b/app/models/user.rb
index d703f9588..c9309bc21 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -74,6 +74,9 @@ class User < ApplicationRecord
   has_many :applications, class_name: 'Doorkeeper::Application', as: :owner
   has_many :backups, inverse_of: :user
 
+  has_one :invite_request, class_name: 'UserInviteRequest', inverse_of: :user, dependent: :destroy
+  accepts_nested_attributes_for :invite_request, reject_if: ->(attributes) { attributes['text'].blank? }
+
   validates :locale, inclusion: I18n.available_locales.map(&:to_s), if: :locale?
   validates_with BlacklistedEmailValidator, if: :email_changed?
   validates_with EmailMxValidator, if: :validate_email_dns?
diff --git a/app/models/user_invite_request.rb b/app/models/user_invite_request.rb
new file mode 100644
index 000000000..2b76c88b9
--- /dev/null
+++ b/app/models/user_invite_request.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+# == Schema Information
+#
+# Table name: user_invite_requests
+#
+#  id         :bigint(8)        not null, primary key
+#  user_id    :bigint(8)
+#  text       :text
+#  created_at :datetime         not null
+#  updated_at :datetime         not null
+#
+
+class UserInviteRequest < ApplicationRecord
+  belongs_to :user, inverse_of: :invite_request
+  validates :text, presence: true, length: { maximum: 420 }
+end
diff --git a/app/views/about/_registration.html.haml b/app/views/about/_registration.html.haml
index 09cbe2e28..ff32ec8c4 100644
--- a/app/views/about/_registration.html.haml
+++ b/app/views/about/_registration.html.haml
@@ -10,6 +10,11 @@
       = f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
       = f.input :password_confirmation, placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
 
+    - if approved_registrations?
+      .fields-group
+        = f.simple_fields_for :invite_request do |invite_request_fields|
+          = invite_request_fields.input :text, as: :text, wrapper: :with_block_label, required: false
+
     .fields-group
       = f.input :agreement, as: :boolean, wrapper: :with_label, label: t('auth.checkbox_agreement_html', rules_path: about_more_path, terms_path: terms_path), disabled: closed_registrations?
 
diff --git a/app/views/admin/pending_accounts/_account.html.haml b/app/views/admin/pending_accounts/_account.html.haml
index c520dc065..1ed5dafdd 100644
--- a/app/views/admin/pending_accounts/_account.html.haml
+++ b/app/views/admin/pending_accounts/_account.html.haml
@@ -1,14 +1,14 @@
 .batch-table__row
   %label.batch-table__row__select.batch-table__row__select--aligned.batch-checkbox
     = f.check_box :account_ids, { multiple: true, include_hidden: false }, account.id
-  .batch-table__row__content.batch-table__row__content--unpadded
-    %table.accounts-table
-      %tbody
-        %tr
-          %td
-            = account.user_email
-            = "(@#{account.username})"
-            %br/
-            = account.user_current_sign_in_ip
-          %td.accounts-table__count
-            = table_link_to 'pencil', t('admin.accounts.edit'), admin_account_path(account.id)
+  .batch-table__row__content.pending-account
+    .pending-account__header
+      = link_to admin_account_path(account.id) do
+        %strong= account.user_email
+        = "(@#{account.username})"
+      %br/
+      = account.user_current_sign_in_ip
+
+    - if account.user&.invite_request&.text&.present?
+      .pending-account__body
+        %p= account.user&.invite_request&.text
diff --git a/app/views/auth/registrations/new.html.haml b/app/views/auth/registrations/new.html.haml
index 1caf2b401..bd6e3a13f 100644
--- a/app/views/auth/registrations/new.html.haml
+++ b/app/views/auth/registrations/new.html.haml
@@ -21,12 +21,19 @@
 
   .fields-group
     = f.input :password, wrapper: :with_label, label: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' }
+
   .fields-group
     = f.input :password_confirmation, wrapper: :with_label, label: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password'), :autocomplete => 'off' }
 
+  - if approved_registrations? && !@invite.present?
+    .fields-group
+      = f.simple_fields_for :invite_request do |invite_request_fields|
+        = invite_request_fields.input :text, as: :text, wrapper: :with_block_label, required: false
+
   = f.input :invite_code, as: :hidden
 
-  %p.hint= t('auth.agreement_html', rules_path: about_more_path, terms_path: terms_path)
+  .fields-group
+    = f.input :agreement, as: :boolean, wrapper: :with_label, label: t('auth.checkbox_agreement_html', rules_path: about_more_path, terms_path: terms_path)
 
   .actions
     = f.button :button, sign_up_message, type: :submit
diff --git a/config/locales/ar.yml b/config/locales/ar.yml
index d409ad99a..e0ccb63a9 100644
--- a/config/locales/ar.yml
+++ b/config/locales/ar.yml
@@ -498,7 +498,6 @@ ar:
     warning: كن حذرا مع هذه البيانات. لا تقم أبدا بمشاركتها مع الآخَرين !
     your_token: رمز نفاذك
   auth:
-    agreement_html: بمجرد النقر على "التسجيل" أسفله، فإنك تُصرِّح قبول <a href="%{rules_path}">قواعد مثيل الخادوم</a> و <a href="%{terms_path}">شروط الخدمة التي نوفرها لك</a>.
     change_password: الكلمة السرية
     confirm_email: تأكيد عنوان البريد الإلكتروني
     delete_account: حذف حساب
diff --git a/config/locales/ast.yml b/config/locales/ast.yml
index cbfd27b04..f6892923c 100644
--- a/config/locales/ast.yml
+++ b/config/locales/ast.yml
@@ -123,7 +123,6 @@ ast:
     invalid_url: La URL apurrida nun ye válida
     warning: Ten curiáu con estos datos, ¡enxamás nun los compartas con naide!
   auth:
-    agreement_html: Faciendo clic en «Aniciar sesión» aceutes siguir <a href="%{rules_path}"> les regles de la instancia</a> y <a href="%{terms_path}">los nuesos términos del serviciu</a>.
     change_password: Contraseña
     delete_account: Desaniciu de la cuenta
     delete_account_html: Si deseyes desaniciar la to cuenta, pues <a href="%{path}">siguir equí</a>. Va pidísete la confirmación.
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index c6ab35cb6..5fd2ff823 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -507,7 +507,6 @@ ca:
     warning: Aneu amb compte amb aquestes dades. No les compartiu mai amb ningú!
     your_token: El teu identificador d'accés
   auth:
-    agreement_html: Al fer clic en "Registre" acceptes respectar <a href="%{rules_path}">les normes del servidor</a> i <a href="%{terms_path}">els nostres termes del servei</a>.
     apply_for_account: Demana una invitació
     change_password: Contrasenya
     checkbox_agreement_html: Estic d'acord amb les <a href="%{rules_path}" target="_blank">normes del servidor</a> i <a href="%{terms_path}" target="_blank"> els termes del servei</a>
diff --git a/config/locales/co.yml b/config/locales/co.yml
index c751c80f0..c4122b6d9 100644
--- a/config/locales/co.yml
+++ b/config/locales/co.yml
@@ -513,7 +513,6 @@ co:
     warning: Abbadate à quessi dati. Ùn i date à nisunu!
     your_token: Rigenerà a fiscia d’accessu
   auth:
-    agreement_html: Cliccà "Arregistrassi" quì sottu vole dì chì site d’accunsentu per siguità <a href="%{rules_path}">e regule di u servore</a> è <a href="%{terms_path}">e cundizione d’usu</a>.
     apply_for_account: Dumandà un'invitazione
     change_password: Chjave d’accessu
     checkbox_agreement_html: Sò d'accunsentu cù e <a href="%{rules_path}" target="_blank">regule di u servore</a> è i <a href="%{terms_path}" target="_blank">termini di u serviziu</a>
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 15cc025f2..7917166de 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -518,7 +518,6 @@ cs:
     warning: Buďte s těmito daty velmi opatrní. Nikdy je s nikým nesdílejte!
     your_token: Váš přístupový token
   auth:
-    agreement_html: Kliknutím na tlačítko „Registrovat“ souhlasíte s následováním <a href="%{rules_path}">pravidel tohoto serveru</a> a <a href="%{terms_path}">našich podmínek používání</a>.
     apply_for_account: Vyžádat si pozvánku
     change_password: Heslo
     checkbox_agreement_html: Souhlasím s <a href="%{rules_path}" target="_blank">pravidly serveru</a> a <a href="%{terms_path}" target="_blank">podmínkami používání</a>
diff --git a/config/locales/cy.yml b/config/locales/cy.yml
index 68a445e4c..9ab4fc394 100644
--- a/config/locales/cy.yml
+++ b/config/locales/cy.yml
@@ -506,7 +506,6 @@ cy:
     warning: Byddwch yn ofalus a'r data hyn. Peidiwch a'i rannu byth!
     your_token: Eich tocyn mynediad
   auth:
-    agreement_html: Wrth glicio "Cofrestru" isod yr ydych yn cytuno i ddilyn <a href="%{rules_path}">y rheolau ar gyfer yr achos hwn</a> a <a href="%{terms_path}">ein termau gwasanaeth</a>.
     change_password: Cyfrinair
     confirm_email: Cadarnhau e-bost
     delete_account: Dileu cyfrif
diff --git a/config/locales/da.yml b/config/locales/da.yml
index 88bf05d17..2156acb44 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -432,7 +432,6 @@ da:
     warning: Vær meget forsigtig med disse data. Del dem aldrig med nogen!
     your_token: Din adgangs token
   auth:
-    agreement_html: Ved at oprette dig erklærer du dig enig i at følge <a href="%{rules_path}">serverens regler</a> og <a href="%{terms_path}">vores servicevilkår</a>.
     change_password: Kodeord
     confirm_email: Bekræft email
     delete_account: Slet konto
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 5b51f9d85..cfe527b0a 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -511,7 +511,6 @@ de:
     warning: Sei mit diesen Daten sehr vorsichtig. Teile sie mit niemandem!
     your_token: Dein Zugangs-Token
   auth:
-    agreement_html: Indem du dich registrierst, erklärst du dich mit den untenstehenden <a href="%{rules_path}">Regeln des Servers</a> und der <a href="%{terms_path}">Datenschutzerklärung</a> einverstanden.
     apply_for_account: Eine Einladung anfragen
     change_password: Passwort
     checkbox_agreement_html: Ich akzeptiere die <a href="%{rules_path}" target="_blank">Server-Regeln</a> und die <a href="%{terms_path}" target="_blank">Nutzungsbedingungen</a>
diff --git a/config/locales/el.yml b/config/locales/el.yml
index b8fd45a68..8ff42acbf 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -506,7 +506,6 @@ el:
     warning: Μεγάλη προσοχή με αυτά τα στοιχεία. Μην τα μοιραστείς ποτέ με κανέναν!
     your_token: Το διακριτικό πρόσβασής σου (access token)
   auth:
-    agreement_html: Επιλέγοντας το "Εγγραφή", συμφωνείς πως δέχεσαι <a href="%{rules_path}">τους κανόνες αυτού του κόμβου</a> και <a href="%{terms_path}">τους όρους χρήσης του</a>.
     apply_for_account: Αίτηση πρόσκλησης
     change_password: Συνθηματικό
     checkbox_agreement_html: Συμφωνώ με τους <a href="%{rules_path}" target="_blank">κανονισμούς του κόμβου</a> και <a href="%{terms_path}" target="_blank">τους όρους χρήσης</a>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 139803aff..60540ecdc 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -513,7 +513,6 @@ en:
     warning: Be very careful with this data. Never share it with anyone!
     your_token: Your access token
   auth:
-    agreement_html: By clicking "Sign up" below you agree to follow <a href="%{rules_path}">the rules of the server</a> and <a href="%{terms_path}">our terms of service</a>.
     apply_for_account: Request an invite
     change_password: Password
     checkbox_agreement_html: I agree to the <a href="%{rules_path}" target="_blank">server rules</a> and <a href="%{terms_path}" target="_blank">terms of service</a>
diff --git a/config/locales/en_GB.yml b/config/locales/en_GB.yml
index 9e6eb5e94..743989879 100644
--- a/config/locales/en_GB.yml
+++ b/config/locales/en_GB.yml
@@ -506,7 +506,6 @@ en_GB:
     warning: Be very careful with this data. Never share it with anyone!
     your_token: Your access token
   auth:
-    agreement_html: By clicking "Sign up" below you agree to follow <a href="%{rules_path}">the rules of the server</a> and <a href="%{terms_path}">our terms of service</a>.
     apply_for_account: Request an invite
     change_password: Password
     checkbox_agreement_html: I agree to the <a href="%{rules_path}" target="_blank">server rules</a> and <a href="%{terms_path}" target="_blank">terms of service</a>
diff --git a/config/locales/eo.yml b/config/locales/eo.yml
index dcbf0065b..cce32cc56 100644
--- a/config/locales/eo.yml
+++ b/config/locales/eo.yml
@@ -507,7 +507,6 @@ eo:
     warning: Estu tre atenta kun ĉi tiu datumo. Neniam diskonigu ĝin al iu ajn!
     your_token: Via alira ĵetono
   auth:
-    agreement_html: Klakante “Registriĝi” sube, vi konsentas kun <a href="%{rules_path}">la reguloj de la servilo</a> kaj <a href="%{terms_path}">niaj uzkondiĉoj</a>.
     apply_for_account: Peti inviton
     change_password: Pasvorto
     checkbox_agreement_html: Mi samopinii al la <a href="%{rules_path}" target="_blank">Servo reguloj</a> kaj <a href="%{terms_path}" target="_blank">kondiĉo al servadon</a>
diff --git a/config/locales/es.yml b/config/locales/es.yml
index bcc3fe62c..c0b6cfb3b 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -437,7 +437,6 @@ es:
     warning: Ten mucho cuidado con estos datos. ¡No los compartas con nadie!
     your_token: Tu token de acceso
   auth:
-    agreement_html: Al hacer click en "Registrarse" acepta seguir <a href="%{rules_path}">las reglas de la instancia</a> y <a href="%{terms_path}">nuestros términos de servicio</a>.
     change_password: Contraseña
     confirm_email: Confirmar email
     delete_account: Borrar cuenta
diff --git a/config/locales/eu.yml b/config/locales/eu.yml
index 187a5325b..50e5b6639 100644
--- a/config/locales/eu.yml
+++ b/config/locales/eu.yml
@@ -481,7 +481,6 @@ eu:
     warning: Kontuz datu hauekin, ez partekatu inoiz inorekin!
     your_token: Zure sarbide token-a
   auth:
-    agreement_html: '"Izena eman" botoia sakatzean <a href="%{rules_path}">zerbitzariaren arauak</a> eta <a href="%{terms_path}">erabilera baldintzak</a> onartzen dituzu.'
     change_password: Pasahitza
     confirm_email: Berretsi e-mail helbidea
     delete_account: Ezabatu kontua
diff --git a/config/locales/fa.yml b/config/locales/fa.yml
index d4ec320cb..0cf380921 100644
--- a/config/locales/fa.yml
+++ b/config/locales/fa.yml
@@ -506,7 +506,6 @@ fa:
     warning: خیلی مواظب این اطلاعات باشید و آن را به هیچ کس ندهید!
     your_token: کد دسترسی شما
   auth:
-    agreement_html: با کلیک روی دکمهٔ عضو شدن، شما <a href="%{rules_path}">قوانین این سرور</a> و <a href="%{terms_path}">شرایط استفادهٔ</a> ما را می‌پذیرید.
     apply_for_account: درخواست دعوت‌نامه
     change_password: رمز
     checkbox_agreement_html: من <a href="%{rules_path}" target="_blank">قانون‌های این سرور</a> و <a href="%{terms_path}" target="_blank">شرایط کاربری</a> را می‌پذیرم
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index 029696f7d..47ff00434 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -370,7 +370,6 @@ fi:
     warning: Säilytä tietoa hyvin. Älä milloinkaan jaa sitä muille!
     your_token: Pääsytunnus
   auth:
-    agreement_html: Rekisteröityessäsi sitoudut noudattamaan <a href="%{rules_path}">instanssin sääntöjä</a> ja <a href="%{terms_path}">käyttöehtoja</a>.
     change_password: Salasana
     confirm_email: Vahvista sähköpostiosoite
     delete_account: Poista tili
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 421ba1da9..f1d81acf0 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -482,7 +482,6 @@ fr:
     warning: Soyez prudent⋅e avec ces données. Ne les partagez pas !
     your_token: Votre jeton d’accès
   auth:
-    agreement_html: En cliquant sur "S'inscrire" ci-dessous, vous souscrivez <a href="%{rules_path}">aux règles du serveur</a> et à <a href="%{terms_path}">nos conditions d’utilisation</a>.
     change_password: Mot de passe
     confirm_email: Confirmer mon adresse mail
     delete_account: Supprimer le compte
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 32f642e16..0ee3a329c 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -506,7 +506,6 @@ gl:
     warning: Teña moito tino con estos datos. Nunca os comparta con ninguén!
     your_token: O seu testemuño de acceso
   auth:
-    agreement_html: Ao pulsar "Rexistrar" vostede acorda seguir <a href="%{rules_path}">as normas do servidor</a> e <a href="%{terms_path}">os termos do servizo</a>.
     apply_for_account: Solicite un convite
     change_password: Contrasinal
     checkbox_agreement_html: Acepto as <a href="%{rules_path}" target="_blank">regras do servidor</a> e os <a href="%{terms_path}" target="_blank">termos do servizo</a>
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index 04318f5e4..f32f6f407 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -309,7 +309,6 @@ hu:
     warning: Ez érzékeny adat. Soha ne oszd meg másokkal!
     your_token: Hozzáférési kulcsod
   auth:
-    agreement_html: A feliratkozással elfogatod az <a href="%{rules_path}">instancia szabályzatát</a> és a <a href="%{terms_path}">felhasználási feltételeket</a>.
     delete_account: Felhasználói fiók törlése
     delete_account_html: Felhasználói fiókod törléséhez <a href="%{path}">kattints ide</a>. A rendszer újbóli megerősítést fog kérni.
     didnt_get_confirmation: Nem kaptad meg a megerősítési lépéseket?
diff --git a/config/locales/it.yml b/config/locales/it.yml
index 384ba918b..bb170bc4a 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -467,7 +467,6 @@ it:
     token_regenerated: Token di accesso rigenerato
     warning: Fa' molta attenzione con questi dati. Non fornirli mai a nessun altro!
   auth:
-    agreement_html: Iscrivendoti, accetti di seguire <a href="%{rules_path}">le regole del server</a> e <a href="%{terms_path}"> le nostre condizioni di servizio</a>.
     change_password: Password
     confirm_email: Conferma email
     delete_account: Elimina account
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index f68df9710..85e97580e 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -512,7 +512,6 @@ ja:
     warning: このデータは気をつけて取り扱ってください。他の人と共有しないでください!
     your_token: アクセストークン
   auth:
-    agreement_html: 登録するをクリックすると <a href="%{rules_path}">サーバーのルール</a> と <a href="%{terms_path}">プライバシーポリシー</a> に従うことに同意したことになります。
     apply_for_account: 登録を申請する
     change_password: パスワード
     checkbox_agreement_html: <a href="%{rules_path}" target="_blank">サーバーのルール</a> と <a href="%{terms_path}" target="_blank">プライバシーポリシー</a> に同意します
diff --git a/config/locales/ka.yml b/config/locales/ka.yml
index 8e537c745..758a0429e 100644
--- a/config/locales/ka.yml
+++ b/config/locales/ka.yml
@@ -401,7 +401,6 @@ ka:
     warning: იყავით ძალიან ფრთხილად ამ მონაცემთან. არასდროს გააზიაროთ ეს!
     your_token: თქვენი წვდომის ტოკენი
   auth:
-    agreement_html: რეგისტრაციით თქვენ ეთანხმებით <a href="%{rules_path}">ინსტანციის წესებს</a> და <a href="%{terms_path}">ჩვენ მომსახურების პირობებს</a>.
     change_password: პაროლი
     confirm_email: ელ-ფოსტის დამოწმება
     delete_account: ანგარიშის გაუქმება
diff --git a/config/locales/kk.yml b/config/locales/kk.yml
index 4ac4c08b9..da91ca9c4 100644
--- a/config/locales/kk.yml
+++ b/config/locales/kk.yml
@@ -482,7 +482,6 @@ kk:
     warning: Be very carеful with this data. Never share it with anyone!
     your_token: Your access tokеn
   auth:
-    agreement_html: '"Тіркелу" батырмасын басу арқылы <a href="%{rules_path}">сервер ережелері</a> мен <a href="%{terms_path}">қолдану шарттарына</a> келісесіз.'
     change_password: Құпиясөз
     confirm_email: Еmаil құптау
     delete_account: Аккаунт өшіру
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 90996b466..c97fd8209 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -514,7 +514,6 @@ ko:
     warning: 이 데이터를 조심히 다뤄 주세요. 다른 사람들과 절대로 공유하지 마세요!
     your_token: 액세스 토큰
   auth:
-    agreement_html: 이 등록으로 이 서버의 <a href="%{rules_path}">이용규약</a> 과 <a href="%{terms_path}">약관</a>에 동의하는 것으로 간주됩니다.
     apply_for_account: 가입 요청하기
     change_password: 패스워드
     checkbox_agreement_html: <a href="%{rules_path}" target="_blank">서버 규칙</a>과 <a href="%{terms_path}" target="_blank">이용약관</a>에 동의합니다
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index 0f5ca3091..97994c362 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -490,7 +490,6 @@ lt:
     warning: Būkite atsargūs su šia informacija. Niekada jos nesidalinkite!
     your_token: Jūsų prieigos žetonas
   auth:
-    agreement_html: Paspaudus "Sign up" Jūs sutinkate sekti <a href="%{rules_path}">serverio taisykles</a> bei <a href="%{terms_path}">naudojimo sąlygas</a>.
     change_password: Slaptažodis
     confirm_email: Patvirtinti el paštą
     delete_account: Ištrinti paskyrą
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 2bfab2454..ca0f57ae0 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -506,7 +506,6 @@ nl:
     warning: Wees voorzichtig met deze gegevens. Deel het nooit met iemand anders!
     your_token: Jouw toegangscode
   auth:
-    agreement_html: Wanneer je op registreren klikt ga je akkoord met het opvolgen van <a href="%{rules_path}">de regels van deze server</a> en <a href="%{terms_path}">onze gebruiksvoorwaarden</a>.
     apply_for_account: Een uitnodiging aanvragen
     change_password: Wachtwoord
     checkbox_agreement_html: Ik ga akkoord met de <a href="%{rules_path}" target="_blank">regels van deze server</a> en de <a href="%{terms_path}" target="_blank">gebruiksvoorwaarden</a>
diff --git a/config/locales/no.yml b/config/locales/no.yml
index 773f2d060..d6475afd6 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -309,7 +309,6 @@
     warning: Vær veldig forsiktig med denne data. Aldri del den med noen!
     your_token: Din tilgangsnøkkel
   auth:
-    agreement_html: Ved å registrere deg godtar du å følge <a href="%{rules_path}">instansens regler</a> og <a href="%{terms_path}">våre brukervilkår</a>.
     delete_account: Slett konto
     delete_account_html: Hvis du ønsker å slette din konto kan du <a href="%{path}">fortsette her</a>. Du vil bli spurt om bekreftelse.
     didnt_get_confirmation: Mottok du ikke instruksjoner om bekreftelse?
diff --git a/config/locales/oc.yml b/config/locales/oc.yml
index 85df11cf6..d1c6d11d9 100644
--- a/config/locales/oc.yml
+++ b/config/locales/oc.yml
@@ -498,7 +498,6 @@ oc:
     warning: Mèfi ! Agachatz de partejar aquela donada amb degun !
     your_token: Vòstre geton d’accès
   auth:
-    agreement_html: En vos marcar acceptatz <a href="%{rules_path}">las règlas del servidor</a> e <a href="%{terms_path}">politica de confidencialitat</a>.
     apply_for_account: Demandar una invitacion
     change_password: Senhal
     checkbox_agreement_html: Accepti las <a href="%{rules_path}" target="_blank">règlas del servidor</a> e <a href="%{terms_path}" target="_blank">los tèrmes del servici</a>
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index f3da82b1c..192a56dcf 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -519,7 +519,6 @@ pl:
     warning: Przechowuj te dane ostrożnie. Nie udostępniaj ich nikomu!
     your_token: Twój token dostępu
   auth:
-    agreement_html: Rejestrując się, oświadczasz, że zapoznałeś(-aś) się z <a href="%{rules_path}">informacjami o serwerze</a> i <a href="%{terms_path}">zasadami korzystania z usługi</a>.
     apply_for_account: Poproś o zaproszenie
     change_password: Hasło
     checkbox_agreement_html: Zgadzam się z <a href="%{rules_path}" target="_blank">regułami serwera</a> i <a href="%{terms_path}" target="_blank">zasadami korzystania z usługi</a>
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 6a82a41b1..4fdacf51d 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -507,7 +507,6 @@ pt-BR:
     warning: Tenha cuidado com estes dados. Nunca compartilhe com alguém!
     your_token: Seu token de acesso
   auth:
-    agreement_html: Ao se cadastrar você concorda em seguir <a href="%{rules_path}">as regras da instância</a> e <a href="%{terms_path}">os nossos termos de serviço</a>.
     apply_for_account: Pedir um convite
     change_password: Senha
     checkbox_agreement_html: Eu concordo com <a href="%{rules_path}" target="_blank">as regras do servidor</a> e com <a href="%{terms_path}" target="_blank">os termos de serviço</a>
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index d943d6511..92c8ab42f 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -482,7 +482,6 @@ pt:
     warning: Cuidado com estes dados. Não partilhar com ninguém!
     your_token: O teu token de acesso
   auth:
-    agreement_html: Registando-te concordas em seguir <a href="%{rules_path}">as regras da instância</a> e <a href="%{terms_path}">os nossos termos de serviço</a>.
     change_password: Palavra-passe
     confirm_email: Confirmar e-mail
     delete_account: Eliminar conta
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index 0331f002f..cdb68c72a 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -8,7 +8,6 @@ ro:
       one: Toot
       other: Toots
   auth:
-    agreement_html: Prin apăsarea butonului Înscriere de mai jos ești deacord cu <a href="%{rules_path}">regulile acestei instanțe</a> și <a href="%{terms_path}">termenii de utilizare al acestui serviciu</a>.
     change_password: Parolă
     confirm_email: Confirmă email
     delete_account: Șterge contul
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index ffc9471cd..e82150258 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -424,7 +424,6 @@ ru:
     warning: Будьте очень внимательны с этими данными. Не делитесь ими ни с кем!
     your_token: Ваш токен доступа
   auth:
-    agreement_html: Создавая аккаунт, вы соглашаетесь с <a href="%{rules_path}">правилами узла</a> и <a href="%{terms_path}">нашими условиями обслуживания</a>.
     change_password: Пароль
     confirm_email: Подтвердите email
     delete_account: Удалить аккаунт
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index 3faaa6ac7..3317127f3 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -41,6 +41,8 @@ en:
         name: 'You might want to use one of these:'
       imports:
         data: CSV file exported from another Mastodon server
+      invite_request:
+        text: This will help us review your application
       sessions:
         otp: 'Enter the two-factor code generated by your phone app or use one of your recovery codes:'
       user:
@@ -118,6 +120,8 @@ en:
         must_be_follower: Block notifications from non-followers
         must_be_following: Block notifications from people you don't follow
         must_be_following_dm: Block direct messages from people you don't follow
+      invite_request:
+        text: Why do you want to join?
       notification_emails:
         digest: Send digest e-mails
         favourite: Send e-mail when someone favourites your status
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index d1ff178fd..9dcb3f470 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -511,7 +511,6 @@ sk:
     warning: Na tieto údaje dávajte ohromný pozor. Nikdy ich s nikým nezďieľajte!
     your_token: Váš prístupový token
   auth:
-    agreement_html: V rámci registrácie súhlasíš, že sa budeš riadiť <a href="%{rules_path}"> pravidlami tohto servera</a>, a taktiež <a href="%{terms_path}"> našími prevádzkovými podmienkami</a>.
     change_password: Heslo
     confirm_email: Potvrdiť email
     delete_account: Vymaž účet
diff --git a/config/locales/sq.yml b/config/locales/sq.yml
index f02c994eb..8303abea8 100644
--- a/config/locales/sq.yml
+++ b/config/locales/sq.yml
@@ -479,7 +479,6 @@ sq:
     warning: Hapni sytë me ato të dhëna. Mos ia jepni kurrë njeriu!
     your_token: Token-i juaj për hyrje
   auth:
-    agreement_html: Duke klikuar mbi "Regjistrohuni" më poshtë, pajtoheni të ndiqni <a href="%{rules_path}">rregullat e shërbyesit</a> dhe <a href="%{terms_path}">kushtet tona të shërbimit</a>.
     change_password: Fjalëkalim
     confirm_email: Ripohoni email-in
     delete_account: Fshije llogarinë
diff --git a/config/locales/sr-Latn.yml b/config/locales/sr-Latn.yml
index a2d57ce29..468867e67 100644
--- a/config/locales/sr-Latn.yml
+++ b/config/locales/sr-Latn.yml
@@ -302,7 +302,6 @@ sr-Latn:
     warning: Oprezno sa ovim podacima. Nikad je ne delite ni sa kim!
     your_token: Vaš pristupni token
   auth:
-    agreement_html: Pristupanjem instanci se slažete sa <a href="%{rules_path}">pravilima instance</a> i <a href="%{terms_path}">uslovima korišćenja</a>.
     delete_account: Obriši nalog
     delete_account_html: Ako želite da obrišete Vaš nalog, možete <a href="%{path}">nastaviti ovde</a>. Bićete upitani da potvrdite.
     didnt_get_confirmation: Niste dobili poruku sa uputstvima za potvrdu naloga?
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index 45a59bcb1..49252b500 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -492,7 +492,6 @@ sr:
     warning: Опрезно са овим подацима. Никад је не делите ни са ким!
     your_token: Ваш приступни токен
   auth:
-    agreement_html: Приступањем инстанци се слажете са <a href="%{rules_path}">правилима инстанце</a> и <a href="%{terms_path}">условима коришћења</a>.
     change_password: Лозинка
     confirm_email: Потврдите адресу е-поште
     delete_account: Обриши налог
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index b0c04329a..ef208acea 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -354,7 +354,6 @@ sv:
     warning: Var mycket försiktig med denna data. Dela aldrig den med någon!
     your_token: Din access token
   auth:
-    agreement_html: Genom att registrera dig godkänner du att följa <a href="%{rules_path}">instansens regler</a> och <a href="%{terms_path}">våra användarvillkor</a>.
     change_password: Lösenord
     confirm_email: Bekräfta e-postadress
     delete_account: Ta bort konto
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index e72e2f461..12f2d13a1 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -386,7 +386,6 @@ uk:
     warning: Будьте дуже обережні з цими даними. Ніколи не діліться ними ні з ким!
     your_token: Ваш токен доступу
   auth:
-    agreement_html: Реєструючись, ви погоджуєтеся виконувати <a href="%{rules_path}">правила інстанції</a> та <a href="%{terms_path}">наші умови використання</a>.
     change_password: Пароль
     confirm_email: Підтвердьте e-mail адресу
     delete_account: Видалити аккаунт
diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml
index bfacc86fc..4eafa70f4 100644
--- a/config/locales/zh-CN.yml
+++ b/config/locales/zh-CN.yml
@@ -410,7 +410,6 @@ zh-CN:
     warning: 一定小心,千万不要把它分享给任何人!
     your_token: 你的访问令牌
   auth:
-    agreement_html: 点击注册即表示你同意遵守<a href="%{rules_path}">本站的相关规定</a>和<a href="%{terms_path}">我们的使用条款</a>。
     change_password: 密码
     confirm_email: 确认电子邮件地址
     delete_account: 删除帐户
diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml
index 7b200e91a..9ff97805d 100644
--- a/config/locales/zh-HK.yml
+++ b/config/locales/zh-HK.yml
@@ -352,7 +352,6 @@ zh-HK:
     warning: 警告,不要把它分享給任何人!
     your_token: token
   auth:
-    agreement_html: 登記即表示你同意遵守<a href="%{rules_path}">本服務站的規則</a>和<a href="%{terms_path}">使用條款</a>。
     change_password: 密碼
     confirm_email: 確認電郵
     delete_account: 刪除帳戶
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 913442e17..9a13a602f 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -436,7 +436,6 @@ zh-TW:
     warning: 警告,不要把它分享給任何人!
     your_token: 你的 token
   auth:
-    agreement_html: 按下下方的「註冊」即代表同意遵守 <a href="%{rules_path}">此伺服器的規則</a> 以及 <a href="%{terms_path}">使用條款</a>。
     change_password: 密碼
     confirm_email: 確認電子信箱位址
     delete_account: 刪除帳戶
diff --git a/db/migrate/20190409054914_create_user_invite_requests.rb b/db/migrate/20190409054914_create_user_invite_requests.rb
new file mode 100644
index 000000000..974e0f69f
--- /dev/null
+++ b/db/migrate/20190409054914_create_user_invite_requests.rb
@@ -0,0 +1,10 @@
+class CreateUserInviteRequests < ActiveRecord::Migration[5.2]
+  def change
+    create_table :user_invite_requests do |t|
+      t.belongs_to :user, foreign_key: { on_delete: :cascade }
+      t.text :text
+
+      t.timestamps
+    end
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 11535d867..3060159d2 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2019_03_17_135723) do
+ActiveRecord::Schema.define(version: 2019_04_09_054914) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -679,6 +679,14 @@ ActiveRecord::Schema.define(version: 2019_03_17_135723) do
     t.index ["uri"], name: "index_tombstones_on_uri"
   end
 
+  create_table "user_invite_requests", force: :cascade do |t|
+    t.bigint "user_id"
+    t.text "text"
+    t.datetime "created_at", null: false
+    t.datetime "updated_at", null: false
+    t.index ["user_id"], name: "index_user_invite_requests_on_user_id"
+  end
+
   create_table "users", force: :cascade do |t|
     t.string "email", default: "", null: false
     t.datetime "created_at", null: false
@@ -816,6 +824,7 @@ ActiveRecord::Schema.define(version: 2019_03_17_135723) do
   add_foreign_key "stream_entries", "accounts", name: "fk_5659b17554", on_delete: :cascade
   add_foreign_key "subscriptions", "accounts", name: "fk_9847d1cbb5", on_delete: :cascade
   add_foreign_key "tombstones", "accounts", on_delete: :cascade
+  add_foreign_key "user_invite_requests", "users", on_delete: :cascade
   add_foreign_key "users", "accounts", name: "fk_50500f500d", on_delete: :cascade
   add_foreign_key "users", "invites", on_delete: :nullify
   add_foreign_key "users", "oauth_applications", column: "created_by_application_id", on_delete: :nullify
diff --git a/spec/fabricators/user_invite_request_fabricator.rb b/spec/fabricators/user_invite_request_fabricator.rb
new file mode 100644
index 000000000..5cc6ae56f
--- /dev/null
+++ b/spec/fabricators/user_invite_request_fabricator.rb
@@ -0,0 +1,4 @@
+Fabricator(:user_invite_request) do
+  user
+  text { Faker::Lorem.sentence }
+end
diff --git a/spec/models/user_invite_request_spec.rb b/spec/models/user_invite_request_spec.rb
new file mode 100644
index 000000000..1be38d8a4
--- /dev/null
+++ b/spec/models/user_invite_request_spec.rb
@@ -0,0 +1,4 @@
+require 'rails_helper'
+
+RSpec.describe UserInviteRequest, type: :model do
+end