about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2017-09-10 13:04:27 -0500
committerDavid Yip <yipdw@member.fsf.org>2017-09-10 13:04:27 -0500
commit932571fa22273e6ff5c229147668c426b4d65326 (patch)
tree973b16e23a7cbeaf5a43550444e54aa1ace50a46
parentc9df53044a333276853f7dc7ef2aed6d48df087f (diff)
parentab71cf4593ed3259168c641d5f4f5a0ebbe4d045 (diff)
Merge tag 'v1.6.0' into sync/upstream
-rw-r--r--app/controllers/admin/settings_controller.rb1
-rw-r--r--app/controllers/api/v1/follows_controller.rb6
-rw-r--r--app/controllers/auth/confirmations_controller.rb6
-rw-r--r--app/javascript/mastodon/features/ui/components/columns_area.js7
-rw-r--r--app/javascript/mastodon/features/ui/components/drawer_loading.js11
-rw-r--r--app/javascript/mastodon/features/ui/components/modal_root.js24
-rw-r--r--app/javascript/mastodon/features/ui/util/async-components.js16
-rw-r--r--app/models/form/admin_settings.rb2
-rw-r--r--app/services/bootstrap_timeline_service.rb34
-rw-r--r--app/services/follow_service.rb4
-rw-r--r--app/views/admin/settings/edit.html.haml5
-rw-r--r--app/views/user_mailer/confirmation_instructions.oc.html.erb6
-rw-r--r--app/views/user_mailer/confirmation_instructions.oc.text.erb6
-rw-r--r--app/views/user_mailer/password_change.oc.html.erb2
-rw-r--r--app/views/user_mailer/password_change.oc.text.erb2
-rw-r--r--app/views/user_mailer/reset_password_instructions.oc.html.erb6
-rw-r--r--app/views/user_mailer/reset_password_instructions.oc.text.erb6
-rw-r--r--app/workers/bootstrap_timeline_worker.rb9
-rw-r--r--config/environments/production.rb2
-rw-r--r--config/locales/en.yml3
-rw-r--r--config/locales/ja.yml3
-rw-r--r--config/settings.yml1
-rw-r--r--lib/mastodon/version.rb2
-rw-r--r--spec/controllers/api/v1/follows_controller_spec.rb5
-rw-r--r--spec/controllers/auth/confirmations_controller_spec.rb18
-rw-r--r--spec/services/bootstrap_timeline_service_spec.rb37
26 files changed, 175 insertions, 49 deletions
diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb
index 5985d6282..c5e6fe4e5 100644
--- a/app/controllers/admin/settings_controller.rb
+++ b/app/controllers/admin/settings_controller.rb
@@ -13,6 +13,7 @@ module Admin
       closed_registrations_message
       open_deletion
       timeline_preview
+      bootstrap_timeline_accounts
     ).freeze
 
     BOOLEAN_SETTINGS = %w(
diff --git a/app/controllers/api/v1/follows_controller.rb b/app/controllers/api/v1/follows_controller.rb
index e01ae5c01..5a2b2f32f 100644
--- a/app/controllers/api/v1/follows_controller.rb
+++ b/app/controllers/api/v1/follows_controller.rb
@@ -10,6 +10,12 @@ class Api::V1::FollowsController < Api::BaseController
     raise ActiveRecord::RecordNotFound if follow_params[:uri].blank?
 
     @account = FollowService.new.call(current_user.account, target_uri).try(:target_account)
+
+    if @account.nil?
+      username, domain = target_uri.split('@')
+      @account         = Account.find_remote!(username, domain)
+    end
+
     render json: @account, serializer: REST::AccountSerializer
   end
 
diff --git a/app/controllers/auth/confirmations_controller.rb b/app/controllers/auth/confirmations_controller.rb
index 2fdb281f4..d5e8e58ed 100644
--- a/app/controllers/auth/confirmations_controller.rb
+++ b/app/controllers/auth/confirmations_controller.rb
@@ -2,4 +2,10 @@
 
 class Auth::ConfirmationsController < Devise::ConfirmationsController
   layout 'auth'
+
+  def show
+    super do |user|
+      BootstrapTimelineWorker.perform_async(user.account_id) if user.errors.empty?
+    end
+  end
 end
diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js
index 7d84bece7..539af8ce3 100644
--- a/app/javascript/mastodon/features/ui/components/columns_area.js
+++ b/app/javascript/mastodon/features/ui/components/columns_area.js
@@ -9,6 +9,7 @@ import { links, getIndex, getLink } from './tabs_bar';
 
 import BundleContainer from '../containers/bundle_container';
 import ColumnLoading from './column_loading';
+import DrawerLoading from './drawer_loading';
 import BundleColumnError from './bundle_column_error';
 import { Compose, Notifications, HomeTimeline, CommunityTimeline, PublicTimeline, HashtagTimeline, FavouritedStatuses } from '../../ui/util/async-components';
 
@@ -129,8 +130,8 @@ export default class ColumnsArea extends ImmutablePureComponent {
     );
   }
 
-  renderLoading = () => {
-    return <ColumnLoading />;
+  renderLoading = columnId => () => {
+    return columnId === 'COMPOSE' ? <DrawerLoading /> : <ColumnLoading />;
   }
 
   renderError = (props) => {
@@ -158,7 +159,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
           const params = column.get('params', null) === null ? null : column.get('params').toJS();
 
           return (
-            <BundleContainer key={column.get('uuid')} fetchComponent={componentMap[column.get('id')]} loading={this.renderLoading} error={this.renderError}>
+            <BundleContainer key={column.get('uuid')} fetchComponent={componentMap[column.get('id')]} loading={this.renderLoading(column.get('id'))} error={this.renderError}>
               {SpecificComponent => <SpecificComponent columnId={column.get('uuid')} params={params} multiColumn />}
             </BundleContainer>
           );
diff --git a/app/javascript/mastodon/features/ui/components/drawer_loading.js b/app/javascript/mastodon/features/ui/components/drawer_loading.js
new file mode 100644
index 000000000..08b0d2347
--- /dev/null
+++ b/app/javascript/mastodon/features/ui/components/drawer_loading.js
@@ -0,0 +1,11 @@
+import React from 'react';
+
+const DrawerLoading = () => (
+  <div className='drawer'>
+    <div className='drawer__pager'>
+      <div className='drawer__inner' />
+    </div>
+  </div>
+);
+
+export default DrawerLoading;
diff --git a/app/javascript/mastodon/features/ui/components/modal_root.js b/app/javascript/mastodon/features/ui/components/modal_root.js
index cd605d7b2..4588cd5fd 100644
--- a/app/javascript/mastodon/features/ui/components/modal_root.js
+++ b/app/javascript/mastodon/features/ui/components/modal_root.js
@@ -5,24 +5,24 @@ import spring from 'react-motion/lib/spring';
 import BundleContainer from '../containers/bundle_container';
 import BundleModalError from './bundle_modal_error';
 import ModalLoading from './modal_loading';
-import ActionsModal from '../components/actions_modal';
+import ActionsModal from './actions_modal';
+import MediaModal from './media_modal';
+import VideoModal from './video_modal';
+import BoostModal from './boost_modal';
+import ConfirmationModal from './confirmation_modal';
 import {
-  MediaModal,
   OnboardingModal,
-  VideoModal,
-  BoostModal,
-  ConfirmationModal,
   ReportModal,
   SettingsModal,
   EmbedModal,
 } from '../../../features/ui/util/async-components';
 
 const MODAL_COMPONENTS = {
-  'MEDIA': MediaModal,
+  'MEDIA': () => Promise.resolve({ default: MediaModal }),
   'ONBOARDING': OnboardingModal,
-  'VIDEO': VideoModal,
-  'BOOST': BoostModal,
-  'CONFIRM': ConfirmationModal,
+  'VIDEO': () => Promise.resolve({ default: VideoModal }),
+  'BOOST': () => Promise.resolve({ default: BoostModal }),
+  'CONFIRM': () => Promise.resolve({ default: ConfirmationModal }),
   'REPORT': ReportModal,
   'SETTINGS': SettingsModal,
   'ACTIONS': () => Promise.resolve({ default: ActionsModal }),
@@ -84,8 +84,8 @@ export default class ModalRoot extends React.PureComponent {
     return { opacity: spring(0), scale: spring(0.98) };
   }
 
-  renderLoading = () => {
-    return <ModalLoading />;
+  renderLoading = modalId => () => {
+    return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? <ModalLoading /> : null;
   }
 
   renderError = (props) => {
@@ -119,7 +119,7 @@ export default class ModalRoot extends React.PureComponent {
               <div key={key} style={{ pointerEvents: visible ? 'auto' : 'none' }}>
                 <div role='presentation' className='modal-root__overlay' style={{ opacity: style.opacity }} onClick={onClose} />
                 <div role='dialog' className='modal-root__container' style={{ opacity: style.opacity, transform: `translateZ(0px) scale(${style.scale})` }}>
-                  <BundleContainer fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading} error={this.renderError} renderDelay={200}>
+                  <BundleContainer fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading(type)} error={this.renderError} renderDelay={200}>
                     {(SpecificComponent) => <SpecificComponent {...props} onClose={onClose} />}
                   </BundleContainer>
                 </div>
diff --git a/app/javascript/mastodon/features/ui/util/async-components.js b/app/javascript/mastodon/features/ui/util/async-components.js
index 3f335c4f8..219b8192b 100644
--- a/app/javascript/mastodon/features/ui/util/async-components.js
+++ b/app/javascript/mastodon/features/ui/util/async-components.js
@@ -82,26 +82,10 @@ export function Mutes () {
   return import(/* webpackChunkName: "features/mutes" */'../../mutes');
 }
 
-export function MediaModal () {
-  return import(/* webpackChunkName: "modals/media_modal" */'../components/media_modal');
-}
-
 export function OnboardingModal () {
   return import(/* webpackChunkName: "modals/onboarding_modal" */'../components/onboarding_modal');
 }
 
-export function VideoModal () {
-  return import(/* webpackChunkName: "modals/video_modal" */'../components/video_modal');
-}
-
-export function BoostModal () {
-  return import(/* webpackChunkName: "modals/boost_modal" */'../components/boost_modal');
-}
-
-export function ConfirmationModal () {
-  return import(/* webpackChunkName: "modals/confirmation_modal" */'../components/confirmation_modal');
-}
-
 export function ReportModal () {
   return import(/* webpackChunkName: "modals/report_modal" */'../components/report_modal');
 }
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index c3a04ba65..2b148c82b 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -24,6 +24,8 @@ class Form::AdminSettings
     :open_deletion=,
     :timeline_preview,
     :timeline_preview=,
+    :bootstrap_timeline_accounts,
+    :bootstrap_timeline_accounts=,
     to: Setting
   )
 end
diff --git a/app/services/bootstrap_timeline_service.rb b/app/services/bootstrap_timeline_service.rb
new file mode 100644
index 000000000..c01e25824
--- /dev/null
+++ b/app/services/bootstrap_timeline_service.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+class BootstrapTimelineService < BaseService
+  def call(source_account)
+    bootstrap_timeline_accounts.each do |target_account|
+      FollowService.new.call(source_account, target_account)
+    end
+  end
+
+  private
+
+  def bootstrap_timeline_accounts
+    return @bootstrap_timeline_accounts if defined?(@bootstrap_timeline_accounts)
+
+    @bootstrap_timeline_accounts = bootstrap_timeline_accounts_usernames.empty? ? admin_accounts : local_unlocked_accounts(bootstrap_timeline_accounts_usernames)
+  end
+
+  def bootstrap_timeline_accounts_usernames
+    @bootstrap_timeline_accounts_usernames ||= (Setting.bootstrap_timeline_accounts || '').split(',').map { |str| str.strip.gsub(/\A@/, '') }.reject(&:blank?)
+  end
+
+  def admin_accounts
+    User.admins
+        .includes(:account)
+        .where(accounts: { locked: false })
+        .map(&:account)
+  end
+
+  def local_unlocked_accounts(usernames)
+    Account.local
+           .where(username: usernames)
+           .where(locked: false)
+  end
+end
diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb
index 941556b60..791773f25 100644
--- a/app/services/follow_service.rb
+++ b/app/services/follow_service.rb
@@ -5,9 +5,9 @@ class FollowService < BaseService
 
   # Follow a remote user, notify remote user about the follow
   # @param [Account] source_account From which to follow
-  # @param [String] uri User URI to follow in the form of username@domain
+  # @param [String, Account] uri User URI to follow in the form of username@domain (or account record)
   def call(source_account, uri)
-    target_account = ResolveRemoteAccountService.new.call(uri)
+    target_account = uri.is_a?(Account) ? uri : ResolveRemoteAccountService.new.call(uri)
 
     raise ActiveRecord::RecordNotFound if target_account.nil? || target_account.id == source_account.id || target_account.suspended?
     raise Mastodon::NotPermittedError  if target_account.blocking?(source_account) || source_account.blocking?(target_account)
diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml
index 9f8a6640b..50d019ec4 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -28,5 +28,10 @@
     = f.input :site_extended_description, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_description_extended.title'), hint: t('admin.settings.site_description_extended.desc_html'), input_html: { rows: 8 }
     = f.input :site_terms, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_terms.title'), hint: t('admin.settings.site_terms.desc_html'), input_html: { rows: 8 }
 
+  %hr/
+
+  .fields-group
+    = f.input :bootstrap_timeline_accounts, wrapper: :with_block_label, label: t('admin.settings.bootstrap_timeline_accounts.title'), hint: t('admin.settings.bootstrap_timeline_accounts.desc_html')
+
   .actions
     = f.button :button, t('generic.save_changes'), type: :submit
diff --git a/app/views/user_mailer/confirmation_instructions.oc.html.erb b/app/views/user_mailer/confirmation_instructions.oc.html.erb
index ed1428a55..7a16db67a 100644
--- a/app/views/user_mailer/confirmation_instructions.oc.html.erb
+++ b/app/views/user_mailer/confirmation_instructions.oc.html.erb
@@ -1,13 +1,13 @@
-<p>Bonjorn <%= @resource.email %> ! <p>
+<p>Bonjorn <%= @resource.email %> !<p>
 
 <p>Venètz de vos crear un compte sus <%= @instance %> e vos mercegem :)</p>
 
-<p>Per confirmar vòstre inscripcion, mercés de clicar sul ligam seguent : <br>
+<p>Per confirmar vòstra inscripcion, mercés de clicar sul ligam seguent : <br>
 <%= link_to 'Confirmar mon compte', confirmation_url(@resource, confirmation_token: @token) %></p>
 
 <p>Aprèp vòstra primièra connexion, poiretz accedir a la documentacion de l’aisina.</p>
 
-<p>Pensatz tanben a gaitar nòstras <%= link_to 'conditions d\'utilisation', terms_url %>.</p>
+<p>Pensatz tanben de gaitar nòstras <%= link_to 'conditions d\'utilisation', terms_url %>.</p>
 
 <p>Amistosament,</p>
 
diff --git a/app/views/user_mailer/confirmation_instructions.oc.text.erb b/app/views/user_mailer/confirmation_instructions.oc.text.erb
index 444d296ce..bf2acfec1 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 476db9536..094c221a8 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 @@
-<p>Bonjorn <%= @resource.email %> ! </p>
+<p>Bonjorn <%= @resource.email %> !</p>
 
 <p>Vos contactem per vos avisar qu’avèm ben cambiat vòstre senhal Mastodon.</p>
diff --git a/app/views/user_mailer/password_change.oc.text.erb b/app/views/user_mailer/password_change.oc.text.erb
index e6caa045c..9fe9116d9 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 7363ee4b6..6c775b3a1 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 @@
-<p>Bonjorn <%= @resource.email %> ! </p>
+<p>Bonjorn <%= @resource.email %> !</p>
 
-<p>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.</p>
+<p>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.</p>
 
 <p><%= link_to 'Modificar mon senhal', edit_password_url(@resource, reset_password_token: @token) %></p>
 
 <p>S’avètz pas res demandat, fasquètz pas cas a aqueste corrièl.</p>
-<p>Vòstre senhal cambiarà pas se clicatz pas sul ligam e que ne causissètz pas un nòu.</p>
+<p>Vòstre senhal cambiarà pas se clicatz pas sul ligam e que ne causissètz pas un novèl.</p>
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 a95a1ae8c..26432d2df 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.</p>
+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.</p>
 
 <%= 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 000000000..89cfb4c3a
--- /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 928fd13e5..dc1ce5ed6 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 4160745f8..64fc556f3 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 fa9e1d112..fcaa64dab 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 acaab3166..39dfb8f55 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 3ab705e26..b6fdb10c6 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 b5e1d16dd..ea9e76d68 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 cf7f91e52..2ec36c060 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 000000000..5189b1de8
--- /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