Bonjorn <%= @resource.email %> !
+
Bonjorn <%= @resource.email %> !
Venètz de vos crear un compte sus <%= @instance %> e vos mercegem :)
-Per confirmar vòstre inscripcion, mercés de clicar sul ligam seguent :
+
Per confirmar vòstra inscripcion, mercés de clicar sul ligam seguent :
<%= link_to 'Confirmar mon compte', confirmation_url(@resource, confirmation_token: @token) %>
Aprèp vòstra primièra connexion, poiretz accedir a la documentacion de l’aisina.
-Pensatz tanben a gaitar nòstras <%= link_to 'conditions d\'utilisation', terms_url %>.
+Pensatz tanben de gaitar nòstras <%= link_to 'conditions d\'utilisation', terms_url %>.
Amistosament,
diff --git a/app/views/user_mailer/confirmation_instructions.oc.text.erb b/app/views/user_mailer/confirmation_instructions.oc.text.erb index 444d296ce6..bf2acfec16 100644 --- a/app/views/user_mailer/confirmation_instructions.oc.text.erb +++ b/app/views/user_mailer/confirmation_instructions.oc.text.erb @@ -1,13 +1,13 @@ -Bonjorn <%= @resource.email %> ! +Bonjorn <%= @resource.email %> ! Venètz de vos crear un compte sus <%= @instance %> e vos mercegem :) -er confirmar vòstre inscripcion, mercés de clicar sul ligam seguent : +er confirmar vòstra inscripcion, mercés de clicar sul ligam seguent : <%= link_to 'Confirmar mon compte', confirmation_url(@resource, confirmation_token: @token) %> Aprèp vòstra primièra connexion, poiretz accedir a la documentacion de l’aisina. -Pensatz tanben a gaitar nòstras <%= link_to 'conditions d\'utilisation', terms_url %>. +Pensatz tanben de gaitar nòstras <%= link_to 'conditions d\'utilisation', terms_url %>. Amistosament, diff --git a/app/views/user_mailer/password_change.oc.html.erb b/app/views/user_mailer/password_change.oc.html.erb index 476db95366..094c221a8a 100644 --- a/app/views/user_mailer/password_change.oc.html.erb +++ b/app/views/user_mailer/password_change.oc.html.erb @@ -1,3 +1,3 @@ -Bonjorn <%= @resource.email %> !
+Bonjorn <%= @resource.email %> !
Vos contactem per vos avisar qu’avèm ben cambiat vòstre senhal Mastodon.
diff --git a/app/views/user_mailer/password_change.oc.text.erb b/app/views/user_mailer/password_change.oc.text.erb index e6caa045cd..9fe9116d95 100644 --- a/app/views/user_mailer/password_change.oc.text.erb +++ b/app/views/user_mailer/password_change.oc.text.erb @@ -1,3 +1,3 @@ -Bonjorn <%= @resource.email %> ! +Bonjorn <%= @resource.email %> ! Vos contactem per vos avisar qu’avèm ben cambiat vòstre senhal Mastodon. diff --git a/app/views/user_mailer/reset_password_instructions.oc.html.erb b/app/views/user_mailer/reset_password_instructions.oc.html.erb index 7363ee4b6a..6c775b3a16 100644 --- a/app/views/user_mailer/reset_password_instructions.oc.html.erb +++ b/app/views/user_mailer/reset_password_instructions.oc.html.erb @@ -1,8 +1,8 @@ -Bonjorn <%= @resource.email %> !
+Bonjorn <%= @resource.email %> !
-Qualqu’un a demandat una reĩnicializacion de vòstre senhal per Mastodon. Podètz realizar la reĩnicializacion en clicant sul ligam çai-jos.
+Qualqu’un a demandat la reĩnicializacion de vòstre senhal per Mastodon. Podètz realizar la reĩnicializacion en clicant sul ligam çai-jos.
<%= link_to 'Modificar mon senhal', edit_password_url(@resource, reset_password_token: @token) %>
S’avètz pas res demandat, fasquètz pas cas a aqueste corrièl.
-Vòstre senhal cambiarà pas se clicatz pas sul ligam e que ne causissètz pas un nòu.
+Vòstre senhal cambiarà pas se clicatz pas sul ligam e que ne causissètz pas un novèl.
diff --git a/app/views/user_mailer/reset_password_instructions.oc.text.erb b/app/views/user_mailer/reset_password_instructions.oc.text.erb index a95a1ae8cd..26432d2df5 100644 --- a/app/views/user_mailer/reset_password_instructions.oc.text.erb +++ b/app/views/user_mailer/reset_password_instructions.oc.text.erb @@ -1,8 +1,8 @@ -Bonjorn <%= @resource.email %> ! +Bonjorn <%= @resource.email %> ! -Qualqu’un a demandat una reĩnicializacion de vòstre senhal per Mastodon. Podètz realizar la reĩnicializacion en clicant sul ligam çai-jos. +Qualqu’un a demandat la reĩnicializacion de vòstre senhal per Mastodon. Podètz realizar la reĩnicializacion en clicant sul ligam çai-jos. <%= link_to 'Modificar mon senhal', edit_password_url(@resource, reset_password_token: @token) %> S’avètz pas res demandat, fasquètz pas cas a aqueste corrièl. -Vòstre senhal cambiarà pas se clicatz pas sul ligam e que ne causissètz pas un nòu. +Vòstre senhal cambiarà pas se clicatz pas sul ligam e que ne causissètz pas un novèl. diff --git a/app/workers/bootstrap_timeline_worker.rb b/app/workers/bootstrap_timeline_worker.rb new file mode 100644 index 0000000000..89cfb4c3ae --- /dev/null +++ b/app/workers/bootstrap_timeline_worker.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class BootstrapTimelineWorker + include Sidekiq::Worker + + def perform(account_id) + BootstrapTimelineService.new.call(Account.find(account_id)) + end +end diff --git a/config/environments/production.rb b/config/environments/production.rb index 928fd13e50..dc1ce5ed66 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -73,7 +73,7 @@ Rails.application.configure do config.action_mailer.perform_caching = false # E-mails - config.action_mailer.default_options = { from: ENV.fetch('SMTP_FROM_ADDRESS') } + config.action_mailer.default_options = { from: ENV.fetch('SMTP_FROM_ADDRESS', 'notifications@localhost') } config.action_mailer.smtp_settings = { :port => ENV['SMTP_PORT'], diff --git a/config/locales/en.yml b/config/locales/en.yml index 4160745f85..64fc556f3d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -167,6 +167,9 @@ en: unresolved: Unresolved view: View settings: + bootstrap_timeline_accounts: + desc_html: Separate multiple usernames by comma. Only local and unlocked accounts will work. Default when empty is all local admins. + title: Default follows for new users contact_information: email: Business e-mail username: Contact username diff --git a/config/locales/ja.yml b/config/locales/ja.yml index fa9e1d1126..fcaa64dab4 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -167,6 +167,9 @@ ja: unresolved: 未解決 view: 表示 settings: + bootstrap_timeline_accounts: + desc_html: 複数のユーザー名はコンマで区切ります。ローカルの公開アカウントのみ有効です。指定しない場合は管理者がデフォルトで指定されます。 + title: 新規ユーザーが自動フォローするアカウント contact_information: email: ビジネスメールアドレス username: 連絡先のユーザー名 diff --git a/config/settings.yml b/config/settings.yml index acaab31667..39dfb8f552 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -41,6 +41,7 @@ defaults: &defaults - root - webmaster - administrator + bootstrap_timeline_accounts: '' development: <<: *defaults diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 3ab705e260..b6fdb10c67 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -21,7 +21,7 @@ module Mastodon end def flags - 'rc4' + '' end def to_a diff --git a/spec/controllers/api/v1/follows_controller_spec.rb b/spec/controllers/api/v1/follows_controller_spec.rb index b5e1d16dd7..ea9e76d686 100644 --- a/spec/controllers/api/v1/follows_controller_spec.rb +++ b/spec/controllers/api/v1/follows_controller_spec.rb @@ -42,5 +42,10 @@ RSpec.describe Api::V1::FollowsController, type: :controller do it 'subscribes to remote hub' do expect(a_request(:post, "https://quitter.no/main/push/hub")).to have_been_made end + + it 'returns http success if already following, too' do + post :create, params: { uri: 'gargron@quitter.no' } + expect(response).to have_http_status(:success) + end end end diff --git a/spec/controllers/auth/confirmations_controller_spec.rb b/spec/controllers/auth/confirmations_controller_spec.rb index cf7f91e528..2ec36c060b 100644 --- a/spec/controllers/auth/confirmations_controller_spec.rb +++ b/spec/controllers/auth/confirmations_controller_spec.rb @@ -10,4 +10,22 @@ describe Auth::ConfirmationsController, type: :controller do expect(response).to have_http_status(:success) end end + + describe 'GET #show' do + let!(:user) { Fabricate(:user, confirmation_token: 'foobar', confirmed_at: nil) } + + before do + allow(BootstrapTimelineWorker).to receive(:perform_async) + @request.env['devise.mapping'] = Devise.mappings[:user] + get :show, params: { confirmation_token: 'foobar' } + end + + it 'redirects to login' do + expect(response).to redirect_to(new_user_session_path) + end + + it 'queues up bootstrapping of home timeline' do + expect(BootstrapTimelineWorker).to have_received(:perform_async).with(user.account_id) + end + end end diff --git a/spec/services/bootstrap_timeline_service_spec.rb b/spec/services/bootstrap_timeline_service_spec.rb new file mode 100644 index 0000000000..5189b1de84 --- /dev/null +++ b/spec/services/bootstrap_timeline_service_spec.rb @@ -0,0 +1,37 @@ +require 'rails_helper' + +RSpec.describe BootstrapTimelineService do + subject { described_class.new } + + describe '#call' do + let(:source_account) { Fabricate(:account) } + + context 'when setting is empty' do + let!(:admin) { Fabricate(:user, admin: true) } + + before do + Setting.bootstrap_timeline_accounts = nil + subject.call(source_account) + end + + it 'follows admin accounts from account' do + expect(source_account.following?(admin.account)).to be true + end + end + + context 'when setting is set' do + let!(:alice) { Fabricate(:account, username: 'alice') } + let!(:bob) { Fabricate(:account, username: 'bob') } + + before do + Setting.bootstrap_timeline_accounts = 'alice, bob' + subject.call(source_account) + end + + it 'follows found accounts from account' do + expect(source_account.following?(alice)).to be true + expect(source_account.following?(bob)).to be true + end + end + end +end