about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-03-28 16:22:28 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-03-28 16:22:28 +0200
commitf313bf3e97ddd83e7847ae00f5bdb488942c943c (patch)
tree5035b4504d35a85cb0b2fcbc65ce57ed5d0de71d
parenta4e1830b5f15118bf2532401005376a0c6e896e6 (diff)
parent30658924a80434e6a2bceb61267b911ea8d37898 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
-rw-r--r--.circleci/config.yml2
-rw-r--r--app/chewy/statuses_index.rb4
-rw-r--r--app/helpers/formatting_helper.rb12
-rw-r--r--app/lib/feed_manager.rb2
-rw-r--r--app/serializers/activitypub/actor_serializer.rb4
-rw-r--r--app/serializers/rest/account_serializer.rb4
-rw-r--r--app/views/accounts/_bio.html.haml4
-rw-r--r--app/views/admin/accounts/show.html.haml4
-rw-r--r--app/views/admin/reports/show.html.haml2
-rw-r--r--app/views/directories/index.html.haml2
-rw-r--r--app/views/notification_mailer/_status.text.erb2
-rw-r--r--app/views/notification_mailer/digest.text.erb2
-rw-r--r--config/environments/production.rb6
-rw-r--r--config/locales/en.yml4
-rw-r--r--spec/controllers/admin/accounts_controller_spec.rb10
-rw-r--r--spec/controllers/settings/exports/bookmarks_controller_spec.rb (renamed from spec/controllers/settings/exports/bookmarks_controller_specs.rb)11
-rw-r--r--spec/lib/html_aware_formatter_spec.rb (renamed from spec/lib/html_aware_formatter.rb)0
-rw-r--r--spec/lib/rss/serializer_spec.rb7
-rw-r--r--spec/services/after_block_service_spec.rb8
-rw-r--r--spec/services/delete_account_service_spec.rb14
-rw-r--r--spec/services/mute_service_spec.rb22
-rw-r--r--spec/services/notify_service_spec.rb46
-rw-r--r--spec/services/suspend_account_service_spec.rb12
-rw-r--r--spec/services/unsuspend_account_service_spec.rb26
24 files changed, 99 insertions, 111 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 4fcc8c618..b9228f996 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,7 +1,7 @@
 version: 2.1
 
 orbs:
-  ruby: circleci/ruby@1.4.0
+  ruby: circleci/ruby@1.4.1
   node: circleci/node@5.0.1
 
 executors:
diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb
index d119f7cac..bfd61a048 100644
--- a/app/chewy/statuses_index.rb
+++ b/app/chewy/statuses_index.rb
@@ -1,6 +1,8 @@
 # frozen_string_literal: true
 
 class StatusesIndex < Chewy::Index
+  include FormattingHelper
+
   settings index: { refresh_interval: '15m' }, analysis: {
     filter: {
       english_stop: {
@@ -57,7 +59,7 @@ class StatusesIndex < Chewy::Index
     field :id, type: 'long'
     field :account_id, type: 'long'
 
-    field :text, type: 'text', value: ->(status) { [status.spoiler_text, PlainTextFormatter.new(status.text, status.local?).to_s].concat(status.ordered_media_attachments.map(&:description)).concat(status.preloadable_poll ? status.preloadable_poll.options : []).join("\n\n") } do
+    field :text, type: 'text', value: ->(status) { [status.spoiler_text, extract_status_plain_text(status)].concat(status.ordered_media_attachments.map(&:description)).concat(status.preloadable_poll ? status.preloadable_poll.options : []).join("\n\n") } do
       field :stemmed, type: 'text', analyzer: 'content'
     end
 
diff --git a/app/helpers/formatting_helper.rb b/app/helpers/formatting_helper.rb
index 66e9e1e91..e11156999 100644
--- a/app/helpers/formatting_helper.rb
+++ b/app/helpers/formatting_helper.rb
@@ -9,11 +9,19 @@ module FormattingHelper
     TextFormatter.new(text, options).to_s
   end
 
-  def extract_plain_text(text, local)
-    PlainTextFormatter.new(text, local).to_s
+  def extract_status_plain_text(status)
+    PlainTextFormatter.new(status.text, status.local?).to_s
   end
 
   def status_content_format(status)
     html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
   end
+
+  def account_bio_format(account)
+    html_aware_format(account.note, account.local?)
+  end
+
+  def account_field_value_format(field, with_rel_me: true)
+    html_aware_format(field.value, field.account.local?, with_rel_me: with_rel_me, with_domains: true, multiline: false)
+  end
 end
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb
index fb1d9d2f8..6994f00ae 100644
--- a/app/lib/feed_manager.rb
+++ b/app/lib/feed_manager.rb
@@ -504,7 +504,7 @@ class FeedManager
     status         = status.reblog if status.reblog?
 
     combined_text = [
-      extract_plain_text(status.text, status.local?),
+      extract_status_plain_text(status),
       status.spoiler_text,
       status.preloadable_poll ? status.preloadable_poll.options.join("\n\n") : nil,
       status.ordered_media_attachments.map(&:description).join("\n\n"),
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
index 30f86aae3..e6dd8040e 100644
--- a/app/serializers/activitypub/actor_serializer.rb
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -103,7 +103,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
   end
 
   def summary
-    object.suspended? ? '' : html_aware_format(object.note, object.local?)
+    object.suspended? ? '' : account_bio_format(object)
   end
 
   def icon
@@ -195,7 +195,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
     end
 
     def value
-      html_aware_format(object.value, object.account.local?, with_rel_me: true, with_domains: true, multiline: false)
+      account_field_value_format(object)
     end
   end
 
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index 8227eec6d..113e0cca7 100644
--- a/app/serializers/rest/account_serializer.rb
+++ b/app/serializers/rest/account_serializer.rb
@@ -20,7 +20,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
     attributes :name, :value, :verified_at
 
     def value
-      html_aware_format(object.value, object.account.local?, with_rel_me: true, with_domains: true, multiline: false)
+      account_field_value_format(object)
     end
   end
 
@@ -35,7 +35,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
   end
 
   def note
-    object.suspended? ? '' : html_aware_format(object.note, object.local?)
+    object.suspended? ? '' : account_bio_format(object)
   end
 
   def url
diff --git a/app/views/accounts/_bio.html.haml b/app/views/accounts/_bio.html.haml
index df4f9bdb8..e2539b1d4 100644
--- a/app/views/accounts/_bio.html.haml
+++ b/app/views/accounts/_bio.html.haml
@@ -10,12 +10,12 @@
             - if field.verified?
               %span.verified__mark{ title: t('accounts.link_verified_on', date: l(field.verified_at)) }
                 = fa_icon 'check'
-            = prerender_custom_emojis(html_aware_format(field.value, account.local?, with_rel_me: true, with_domains: true, multiline: false), account.emojis)
+            = prerender_custom_emojis(account_field_value_format(field), account.emojis)
 
   = account_badge(account)
 
   - if account.note.present?
-    .account__header__content.emojify= prerender_custom_emojis(html_aware_format(account.note, account.local?), account.emojis)
+    .account__header__content.emojify= prerender_custom_emojis(account_bio_format(account), account.emojis)
 
   .public-account-bio__extra
     = t 'accounts.joined', date: l(account.created_at, format: :month)
diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml
index b252f3eac..1230294fe 100644
--- a/app/views/admin/accounts/show.html.haml
+++ b/app/views/admin/accounts/show.html.haml
@@ -21,11 +21,11 @@
                 - if field.verified?
                   %span.verified__mark{ title: t('accounts.link_verified_on', date: l(field.verified_at)) }
                     = fa_icon 'check'
-                = prerender_custom_emojis(html_aware_format(field.value, account.local?, with_rel_me: true, with_domains: true, multiline: false), account.emojis)
+                = prerender_custom_emojis(account_field_value_format(field, with_rel_me: false), account.emojis)
 
     - if account.note.present?
       %div
-        .account__header__content.emojify= prerender_custom_emojis(html_aware_format(account.note, account.local?), account.emojis)
+        .account__header__content.emojify= prerender_custom_emojis(account_bio_format(account), account.emojis)
 
 .dashboard__counters.admin-account-counters
   %div
diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml
index b12a934a1..e5ea56779 100644
--- a/app/views/admin/reports/show.html.haml
+++ b/app/views/admin/reports/show.html.haml
@@ -23,7 +23,7 @@
             = fa_icon('lock') if @report.target_account.locked?
       - if @report.target_account.note.present?
         .account-card__bio.emojify
-          = prerender_custom_emojis(html_aware_format(@report.target_account.note, @report.target_account.local?), @report.target_account.emojis)
+          = prerender_custom_emojis(account_bio_format(@report.target_account), @report.target_account.emojis)
       .account-card__actions
         .account-card__counters
           .account-card__counters__item
diff --git a/app/views/directories/index.html.haml b/app/views/directories/index.html.haml
index e06e40491..4872432d4 100644
--- a/app/views/directories/index.html.haml
+++ b/app/views/directories/index.html.haml
@@ -34,7 +34,7 @@
                 = fa_icon('lock') if account.locked?
         - if account.note.present?
           .account-card__bio.emojify
-            = prerender_custom_emojis(html_aware_format(account.note, account.local?), account.emojis)
+            = prerender_custom_emojis(account_bio_format(account), account.emojis)
         - else
           .flex-spacer
         .account-card__actions
diff --git a/app/views/notification_mailer/_status.text.erb b/app/views/notification_mailer/_status.text.erb
index bf6d2b620..1dc8de739 100644
--- a/app/views/notification_mailer/_status.text.erb
+++ b/app/views/notification_mailer/_status.text.erb
@@ -3,6 +3,6 @@
 > ----
 >
 <% end %>
-> <%= raw word_wrap(extract_plain_text(status.text, status.local?), break_sequence: "\n> ") %>
+> <%= raw word_wrap(extract_status_plain_text(status), break_sequence: "\n> ") %>
 
 <%= raw t('application_mailer.view')%> <%= web_url("statuses/#{status.id}") %>
diff --git a/app/views/notification_mailer/digest.text.erb b/app/views/notification_mailer/digest.text.erb
index b767eb9c4..0f84a4ef0 100644
--- a/app/views/notification_mailer/digest.text.erb
+++ b/app/views/notification_mailer/digest.text.erb
@@ -5,7 +5,7 @@
 
 * <%= raw t('notification_mailer.digest.mention', name: notification.from_account.pretty_acct) %>
 
-  <%= raw extract_plain_text(notification.target_status.text, notification.target_status.local?) %>
+  <%= raw extract_status_plain_text(notification.target_status) %>
 
   <%= raw t('application_mailer.view')%> <%= web_url("statuses/#{notification.target_status.id}") %>
 <% end %>
diff --git a/config/environments/production.rb b/config/environments/production.rb
index ce3c41799..40fcd3bdd 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -91,11 +91,13 @@ Rails.application.configure do
 
   # E-mails
   outgoing_email_address = ENV.fetch('SMTP_FROM_ADDRESS', 'notifications@localhost')
-  outgoing_mail_domain   = Mail::Address.new(outgoing_email_address).domain
+  outgoing_email_domain  = Mail::Address.new(outgoing_email_address).domain
+
   config.action_mailer.default_options = {
     from: outgoing_email_address,
     reply_to: ENV['SMTP_REPLY_TO'],
-    'Message-ID': -> { "<#{Mail.random_tag}@#{outgoing_mail_domain}>" },
+    return_path: ENV['SMTP_RETURN_PATH'],
+    message_id: -> { "<#{Mail.random_tag}@#{outgoing_email_domain}>" },
   }
 
   config.action_mailer.smtp_settings = {
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5fa3c012e..829cd61d0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -168,7 +168,6 @@ en:
       previous_strikes_description_html:
         one: This account has <strong>one</strong> strike.
         other: This account has <strong>%{count}</strong> strikes.
-        zero: This account is <strong>in good standing</strong>.
       promote: Promote
       protocol: Protocol
       public: Public
@@ -530,7 +529,6 @@ en:
       known_accounts:
         one: "%{count} known account"
         other: "%{count} known accounts"
-        zero: No known account
       moderation:
         all: All
         limited: Limited
@@ -802,7 +800,6 @@ en:
         shared_by_over_week:
           one: Shared by one person over the last week
           other: Shared by %{count} people over the last week
-          zero: Shared by noone over the last week
         title: Trending links
         usage_comparison: Shared %{today} times today, compared to %{yesterday} yesterday
       pending_review: Pending review
@@ -845,7 +842,6 @@ en:
         used_by_over_week:
           one: Used by one person over the last week
           other: Used by %{count} people over the last week
-          zero: Used by noone over the last week
       title: Trends
     warning_presets:
       add_new: Add new
diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb
index 0f71d697c..1779fb7c0 100644
--- a/spec/controllers/admin/accounts_controller_spec.rb
+++ b/spec/controllers/admin/accounts_controller_spec.rb
@@ -194,9 +194,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
   end
 
   describe 'POST #unblock_email' do
-    subject do
-      -> { post :unblock_email, params: { id: account.id } }
-    end
+    subject { post :unblock_email, params: { id: account.id } }
 
     let(:current_user) { Fabricate(:user, admin: admin) }
     let(:account) { Fabricate(:account, suspended: true) }
@@ -206,11 +204,11 @@ RSpec.describe Admin::AccountsController, type: :controller do
       let(:admin) { true }
 
       it 'succeeds in removing email blocks' do
-        is_expected.to change { CanonicalEmailBlock.where(reference_account: account).count }.from(1).to(0)
+        expect { subject }.to change { CanonicalEmailBlock.where(reference_account: account).count }.from(1).to(0)
       end
 
       it 'redirects to admin account path' do
-        subject.call
+        subject
         expect(response).to redirect_to admin_account_path(account.id)
       end
     end
@@ -219,7 +217,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
       let(:admin) { false }
 
       it 'fails to remove avatar' do
-        subject.call
+        subject
         expect(response).to have_http_status :forbidden
       end
     end
diff --git a/spec/controllers/settings/exports/bookmarks_controller_specs.rb b/spec/controllers/settings/exports/bookmarks_controller_spec.rb
index 85761577b..a06c02e0c 100644
--- a/spec/controllers/settings/exports/bookmarks_controller_specs.rb
+++ b/spec/controllers/settings/exports/bookmarks_controller_spec.rb
@@ -3,11 +3,16 @@ require 'rails_helper'
 describe Settings::Exports::BookmarksController do
   render_views
 
+  let(:user)    { Fabricate(:user) }
+  let(:account) { Fabricate(:account, domain: 'foo.bar') }
+  let(:status)  { Fabricate(:status, account: account, uri: 'https://foo.bar/statuses/1312') }
+
   describe 'GET #index' do
-    it 'returns a csv of the bookmarked toots' do
-      user = Fabricate(:user)
-      user.account.bookmarks.create!(status: Fabricate(:status, uri: 'https://foo.bar/statuses/1312'))
+    before do
+      user.account.bookmarks.create!(status: status)
+    end
 
+    it 'returns a csv of the bookmarked toots' do
       sign_in user, scope: :user
       get :index, format: :csv
 
diff --git a/spec/lib/html_aware_formatter.rb b/spec/lib/html_aware_formatter_spec.rb
index 18d23abf5..18d23abf5 100644
--- a/spec/lib/html_aware_formatter.rb
+++ b/spec/lib/html_aware_formatter_spec.rb
diff --git a/spec/lib/rss/serializer_spec.rb b/spec/lib/rss/serializer_spec.rb
index 0364d13de..1da45d302 100644
--- a/spec/lib/rss/serializer_spec.rb
+++ b/spec/lib/rss/serializer_spec.rb
@@ -13,13 +13,6 @@ describe RSS::Serializer do
 
     subject { RSS::Serializer.new.send(:status_title, status) }
 
-    context 'if destroyed?' do
-      it 'returns "#{account.acct} deleted status"' do
-        status.destroy!
-        expect(subject).to eq "#{account.acct} deleted status"
-      end
-    end
-
     context 'on a toot with long text' do
       let(:text) { "This toot's text is longer than the allowed number of characters" }
 
diff --git a/spec/services/after_block_service_spec.rb b/spec/services/after_block_service_spec.rb
index fe5b26b2b..c09425d7c 100644
--- a/spec/services/after_block_service_spec.rb
+++ b/spec/services/after_block_service_spec.rb
@@ -1,9 +1,7 @@
 require 'rails_helper'
 
 RSpec.describe AfterBlockService, type: :service do
-  subject do
-    -> { described_class.new.call(account, target_account) }
-  end
+  subject { described_class.new.call(account, target_account) }
 
   let(:account)              { Fabricate(:account) }
   let(:target_account)       { Fabricate(:account) }
@@ -24,7 +22,7 @@ RSpec.describe AfterBlockService, type: :service do
       FeedManager.instance.push_to_home(account, other_account_status)
       FeedManager.instance.push_to_home(account, other_account_reblog)
 
-      is_expected.to change {
+      expect { subject }.to change {
         Redis.current.zrange(home_timeline_key, 0, -1)
       }.from([status.id.to_s, other_account_status.id.to_s, other_account_reblog.id.to_s]).to([other_account_status.id.to_s])
     end
@@ -43,7 +41,7 @@ RSpec.describe AfterBlockService, type: :service do
       FeedManager.instance.push_to_list(list, other_account_status)
       FeedManager.instance.push_to_list(list, other_account_reblog)
 
-      is_expected.to change {
+      expect { subject }.to change {
         Redis.current.zrange(list_timeline_key, 0, -1)
       }.from([status.id.to_s, other_account_status.id.to_s, other_account_reblog.id.to_s]).to([other_account_status.id.to_s])
     end
diff --git a/spec/services/delete_account_service_spec.rb b/spec/services/delete_account_service_spec.rb
index 9c785fc17..1fbe4d07c 100644
--- a/spec/services/delete_account_service_spec.rb
+++ b/spec/services/delete_account_service_spec.rb
@@ -23,12 +23,10 @@ RSpec.describe DeleteAccountService, type: :service do
 
     let!(:account_note) { Fabricate(:account_note, account: account) }
 
-    subject do
-      -> { described_class.new.call(account) }
-    end
+    subject { described_class.new.call(account) }
 
     it 'deletes associated owned records' do
-      is_expected.to change {
+      expect { subject }.to change {
         [
           account.statuses,
           account.media_attachments,
@@ -43,7 +41,7 @@ RSpec.describe DeleteAccountService, type: :service do
     end
 
     it 'deletes associated target records' do
-      is_expected.to change {
+      expect { subject }.to change {
         [
           AccountPin.where(target_account: account),
         ].map(&:count)
@@ -51,7 +49,7 @@ RSpec.describe DeleteAccountService, type: :service do
     end
 
     it 'deletes associated target notifications' do
-      is_expected.to change {
+      expect { subject }.to change {
         [
           'poll', 'favourite', 'status', 'mention', 'follow'
         ].map { |type| Notification.where(type: type).count }
@@ -73,7 +71,7 @@ RSpec.describe DeleteAccountService, type: :service do
       let!(:local_follower) { Fabricate(:account) }
 
       it 'sends a delete actor activity to all known inboxes' do
-        subject.call
+        subject
         expect(a_request(:post, "https://alice.com/inbox")).to have_been_made.once
         expect(a_request(:post, "https://bob.com/inbox")).to have_been_made.once
       end
@@ -91,7 +89,7 @@ RSpec.describe DeleteAccountService, type: :service do
       let!(:local_follower) { Fabricate(:account) }
 
       it 'sends a reject follow to follower inboxes' do
-        subject.call
+        subject
         expect(a_request(:post, account.inbox_url)).to have_been_made.once
       end
     end
diff --git a/spec/services/mute_service_spec.rb b/spec/services/mute_service_spec.rb
index 4bb839b8d..bdec1c67b 100644
--- a/spec/services/mute_service_spec.rb
+++ b/spec/services/mute_service_spec.rb
@@ -1,9 +1,7 @@
 require 'rails_helper'
 
 RSpec.describe MuteService, type: :service do
-  subject do
-    -> { described_class.new.call(account, target_account) }
-  end
+  subject { described_class.new.call(account, target_account) }
 
   let(:account) { Fabricate(:account) }
   let(:target_account) { Fabricate(:account) }
@@ -21,45 +19,41 @@ RSpec.describe MuteService, type: :service do
       FeedManager.instance.push_to_home(account, status)
       FeedManager.instance.push_to_home(account, other_account_status)
 
-      is_expected.to change {
+      expect { subject }.to change {
         Redis.current.zrange(home_timeline_key, 0, -1)
       }.from([status.id.to_s, other_account_status.id.to_s]).to([other_account_status.id.to_s])
     end
   end
 
   it 'mutes account' do
-    is_expected.to change {
+    expect { subject }.to change {
       account.muting?(target_account)
     }.from(false).to(true)
   end
 
   context 'without specifying a notifications parameter' do
     it 'mutes notifications from the account' do
-      is_expected.to change {
+      expect { subject }.to change {
         account.muting_notifications?(target_account)
       }.from(false).to(true)
     end
   end
 
   context 'with a true notifications parameter' do
-    subject do
-      -> { described_class.new.call(account, target_account, notifications: true) }
-    end
+    subject { described_class.new.call(account, target_account, notifications: true) }
 
     it 'mutes notifications from the account' do
-      is_expected.to change {
+      expect { subject }.to change {
         account.muting_notifications?(target_account)
       }.from(false).to(true)
     end
   end
 
   context 'with a false notifications parameter' do
-    subject do
-      -> { described_class.new.call(account, target_account, notifications: false) }
-    end
+    subject { described_class.new.call(account, target_account, notifications: false) }
 
     it 'does not mute notifications from the account' do
-      is_expected.to_not change {
+      expect { subject }.to_not change {
         account.muting_notifications?(target_account)
       }.from(false)
     end
diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb
index 83e62ff36..67dd0483b 100644
--- a/spec/services/notify_service_spec.rb
+++ b/spec/services/notify_service_spec.rb
@@ -1,9 +1,7 @@
 require 'rails_helper'
 
 RSpec.describe NotifyService, type: :service do
-  subject do
-    -> { described_class.new.call(recipient, type, activity) }
-  end
+  subject { described_class.new.call(recipient, type, activity) }
 
   let(:user) { Fabricate(:user) }
   let(:recipient) { user.account }
@@ -11,42 +9,42 @@ RSpec.describe NotifyService, type: :service do
   let(:activity) { Fabricate(:follow, account: sender, target_account: recipient) }
   let(:type) { :follow }
 
-  it { is_expected.to change(Notification, :count).by(1) }
+  it { expect { subject }.to change(Notification, :count).by(1) }
 
   it 'does not notify when sender is blocked' do
     recipient.block!(sender)
-    is_expected.to_not change(Notification, :count)
+    expect { subject }.to_not change(Notification, :count)
   end
 
   it 'does not notify when sender is muted with hide_notifications' do
     recipient.mute!(sender, notifications: true)
-    is_expected.to_not change(Notification, :count)
+    expect { subject }.to_not change(Notification, :count)
   end
 
   it 'does notify when sender is muted without hide_notifications' do
     recipient.mute!(sender, notifications: false)
-    is_expected.to change(Notification, :count)
+    expect { subject }.to change(Notification, :count)
   end
 
   it 'does not notify when sender\'s domain is blocked' do
     recipient.block_domain!(sender.domain)
-    is_expected.to_not change(Notification, :count)
+    expect { subject }.to_not change(Notification, :count)
   end
 
   it 'does still notify when sender\'s domain is blocked but sender is followed' do
     recipient.block_domain!(sender.domain)
     recipient.follow!(sender)
-    is_expected.to change(Notification, :count)
+    expect { subject }.to change(Notification, :count)
   end
 
   it 'does not notify when sender is silenced and not followed' do
     sender.silence!
-    is_expected.to_not change(Notification, :count)
+    expect { subject }.to_not change(Notification, :count)
   end
 
   it 'does not notify when recipient is suspended' do
     recipient.suspend!
-    is_expected.to_not change(Notification, :count)
+    expect { subject }.to_not change(Notification, :count)
   end
   
   context 'for direct messages' do
@@ -61,7 +59,7 @@ RSpec.describe NotifyService, type: :service do
       let(:enabled) { true }
 
       it 'does not notify' do
-        is_expected.to_not change(Notification, :count)
+        expect { subject }.to_not change(Notification, :count)
       end
 
       context 'if the message chain is initiated by recipient, but is not direct message' do
@@ -70,7 +68,7 @@ RSpec.describe NotifyService, type: :service do
         let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct, thread: reply_to)) }
 
         it 'does not notify' do
-          is_expected.to_not change(Notification, :count)
+          expect { subject }.to_not change(Notification, :count)
         end
       end
 
@@ -81,7 +79,7 @@ RSpec.describe NotifyService, type: :service do
         let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct, thread: dummy_reply)) }
 
         it 'does not notify' do
-          is_expected.to_not change(Notification, :count)
+          expect { subject }.to_not change(Notification, :count)
         end
       end
 
@@ -91,7 +89,7 @@ RSpec.describe NotifyService, type: :service do
         let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct, thread: reply_to)) }
 
         it 'does notify' do
-          is_expected.to change(Notification, :count)
+          expect { subject }.to change(Notification, :count)
         end
       end
     end
@@ -100,7 +98,7 @@ RSpec.describe NotifyService, type: :service do
       let(:enabled) { false }
 
       it 'does notify' do
-        is_expected.to change(Notification, :count)
+        expect { subject }.to change(Notification, :count)
       end
     end
   end
@@ -112,17 +110,17 @@ RSpec.describe NotifyService, type: :service do
 
     it 'shows reblogs by default' do
       recipient.follow!(sender)
-      is_expected.to change(Notification, :count)
+      expect { subject }.to change(Notification, :count)
     end
 
     it 'shows reblogs when explicitly enabled' do
       recipient.follow!(sender, reblogs: true)
-      is_expected.to change(Notification, :count)
+      expect { subject }.to change(Notification, :count)
     end
 
     it 'shows reblogs when disabled' do
       recipient.follow!(sender, reblogs: false)
-      is_expected.to change(Notification, :count)
+      expect { subject }.to change(Notification, :count)
     end
   end
 
@@ -134,12 +132,12 @@ RSpec.describe NotifyService, type: :service do
 
     it 'does not notify when conversation is muted' do
       recipient.mute_conversation!(activity.status.conversation)
-      is_expected.to_not change(Notification, :count)
+      expect { subject }.to_not change(Notification, :count)
     end
 
     it 'does not notify when it is a reply to a blocked user' do
       recipient.block!(asshole)
-      is_expected.to_not change(Notification, :count)
+      expect { subject }.to_not change(Notification, :count)
     end
   end
 
@@ -147,7 +145,7 @@ RSpec.describe NotifyService, type: :service do
     let(:sender) { recipient }
 
     it 'does not notify when recipient is the sender' do
-      is_expected.to_not change(Notification, :count)
+      expect { subject }.to_not change(Notification, :count)
     end
   end
 
@@ -163,7 +161,7 @@ RSpec.describe NotifyService, type: :service do
       let(:enabled) { true }
 
       it 'sends email' do
-        is_expected.to change(ActionMailer::Base.deliveries, :count).by(1)
+        expect { subject }.to change(ActionMailer::Base.deliveries, :count).by(1)
       end
     end
 
@@ -171,7 +169,7 @@ RSpec.describe NotifyService, type: :service do
       let(:enabled) { false }
 
       it "doesn't send email" do
-        is_expected.to_not change(ActionMailer::Base.deliveries, :count).from(0)
+        expect { subject }.to_not change(ActionMailer::Base.deliveries, :count).from(0)
       end
     end
   end
diff --git a/spec/services/suspend_account_service_spec.rb b/spec/services/suspend_account_service_spec.rb
index cf7eb257a..5d45e4ffd 100644
--- a/spec/services/suspend_account_service_spec.rb
+++ b/spec/services/suspend_account_service_spec.rb
@@ -5,9 +5,7 @@ RSpec.describe SuspendAccountService, type: :service do
     let!(:local_follower) { Fabricate(:user, current_sign_in_at: 1.hour.ago).account }
     let!(:list)           { Fabricate(:list, account: local_follower) }
 
-    subject do
-      -> { described_class.new.call(account) }
-    end
+    subject { described_class.new.call(account) }
 
     before do
       allow(FeedManager.instance).to receive(:unmerge_from_home).and_return(nil)
@@ -18,13 +16,13 @@ RSpec.describe SuspendAccountService, type: :service do
     end
 
     it "unmerges from local followers' feeds" do
-      subject.call
+      subject
       expect(FeedManager.instance).to have_received(:unmerge_from_home).with(account, local_follower)
       expect(FeedManager.instance).to have_received(:unmerge_from_list).with(account, list)
     end
 
     it 'marks account as suspended' do
-      is_expected.to change { account.suspended? }.from(false).to(true)
+      expect { subject }.to change { account.suspended? }.from(false).to(true)
     end
   end
 
@@ -51,7 +49,7 @@ RSpec.describe SuspendAccountService, type: :service do
       end
 
       it 'sends an update actor to followers and reporters' do
-        subject.call
+        subject
         expect(a_request(:post, remote_follower.inbox_url).with { |req| match_update_actor_request(req, account) }).to have_been_made.once
         expect(a_request(:post, remote_reporter.inbox_url).with { |req| match_update_actor_request(req, account) }).to have_been_made.once
       end
@@ -77,7 +75,7 @@ RSpec.describe SuspendAccountService, type: :service do
       end
 
       it 'sends a reject follow' do
-        subject.call
+        subject
         expect(a_request(:post, account.inbox_url).with { |req| match_reject_follow_request(req, account, local_followee) }).to have_been_made.once
       end
     end
diff --git a/spec/services/unsuspend_account_service_spec.rb b/spec/services/unsuspend_account_service_spec.rb
index 0593beb6f..3ac4cc085 100644
--- a/spec/services/unsuspend_account_service_spec.rb
+++ b/spec/services/unsuspend_account_service_spec.rb
@@ -5,9 +5,7 @@ RSpec.describe UnsuspendAccountService, type: :service do
     let!(:local_follower) { Fabricate(:user, current_sign_in_at: 1.hour.ago).account }
     let!(:list)           { Fabricate(:list, account: local_follower) }
 
-    subject do
-      -> { described_class.new.call(account) }
-    end
+    subject { described_class.new.call(account) }
 
     before do
       allow(FeedManager.instance).to receive(:merge_into_home).and_return(nil)
@@ -33,7 +31,7 @@ RSpec.describe UnsuspendAccountService, type: :service do
     end
 
     it 'marks account as unsuspended' do
-      is_expected.to change { account.suspended? }.from(true).to(false)
+      expect { subject }.to change { account.suspended? }.from(true).to(false)
     end
 
     include_examples 'common behavior' do
@@ -47,13 +45,13 @@ RSpec.describe UnsuspendAccountService, type: :service do
       end
 
       it "merges back into local followers' feeds" do
-        subject.call
+        subject
         expect(FeedManager.instance).to have_received(:merge_into_home).with(account, local_follower)
         expect(FeedManager.instance).to have_received(:merge_into_list).with(account, list)
       end
 
       it 'sends an update actor to followers and reporters' do
-        subject.call
+        subject
         expect(a_request(:post, remote_follower.inbox_url).with { |req| match_update_actor_request(req, account) }).to have_been_made.once
         expect(a_request(:post, remote_reporter.inbox_url).with { |req| match_update_actor_request(req, account) }).to have_been_made.once
       end
@@ -75,18 +73,18 @@ RSpec.describe UnsuspendAccountService, type: :service do
         end
 
         it 're-fetches the account' do
-          subject.call
+          subject
           expect(resolve_account_service).to have_received(:call).with(account)
         end
 
         it "merges back into local followers' feeds" do
-          subject.call
+          subject
           expect(FeedManager.instance).to have_received(:merge_into_home).with(account, local_follower)
           expect(FeedManager.instance).to have_received(:merge_into_list).with(account, list)
         end
 
         it 'marks account as unsuspended' do
-          is_expected.to change { account.suspended? }.from(true).to(false)
+          expect { subject }.to change { account.suspended? }.from(true).to(false)
         end
       end
 
@@ -99,18 +97,18 @@ RSpec.describe UnsuspendAccountService, type: :service do
         end
 
         it 're-fetches the account' do
-          subject.call
+          subject
           expect(resolve_account_service).to have_received(:call).with(account)
         end
 
         it "does not merge back into local followers' feeds" do
-          subject.call
+          subject
           expect(FeedManager.instance).to_not have_received(:merge_into_home).with(account, local_follower)
           expect(FeedManager.instance).to_not have_received(:merge_into_list).with(account, list)
         end
 
         it 'does not mark the account as unsuspended' do
-          is_expected.not_to change { account.suspended? }
+          expect { subject }.not_to change { account.suspended? }
         end
       end
 
@@ -120,12 +118,12 @@ RSpec.describe UnsuspendAccountService, type: :service do
         end
 
         it 're-fetches the account' do
-          subject.call
+          subject
           expect(resolve_account_service).to have_received(:call).with(account)
         end
 
         it "does not merge back into local followers' feeds" do
-          subject.call
+          subject
           expect(FeedManager.instance).to_not have_received(:merge_into_home).with(account, local_follower)
           expect(FeedManager.instance).to_not have_received(:merge_into_list).with(account, list)
         end