From d675803f0768eb7479226acd370147c7e3c7f4a3 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 19 Aug 2024 09:52:32 +0200 Subject: [PATCH 1/2] Fix broken notifications for mentions from local moderators in 4.2.11 (#31484) --- app/services/notify_service.rb | 2 +- spec/services/notify_service_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index 2001fa6dace702..515248979ae076 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -87,7 +87,7 @@ def response_to_recipient? def from_staff? sender = @notification.from_account - sender.local? && sender.user.present? && sender.user_role&.overrides?(@recipient.user_role) && @sender.user_role&.highlighted? && sender.user_role&.can?(*UserRole::Flags::CATEGORIES[:moderation]) + sender.local? && sender.user.present? && sender.user_role&.overrides?(@recipient.user_role) && sender.user_role&.highlighted? && sender.user_role&.can?(*UserRole::Flags::CATEGORIES[:moderation].map(&:to_sym)) end def optional_non_following_and_direct? diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb index c2664e79c23bb5..568fb1cdfdb6ec 100644 --- a/spec/services/notify_service_spec.rb +++ b/spec/services/notify_service_spec.rb @@ -18,6 +18,17 @@ expect { subject }.to_not change(Notification, :count) end + context 'when the sender is a local moderator' do + let(:sender) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } + let(:type) { :mention } + let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender)) } + + it 'does notify when the sender is blocked' do + recipient.block!(sender) + expect { subject }.to change(Notification, :count).by(1) + end + end + it 'does not notify when sender is muted with hide_notifications' do recipient.mute!(sender, notifications: true) expect { subject }.to_not change(Notification, :count) From f9a929ed5c71e0aaf42c124e96d499d81507c2ac Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 19 Aug 2024 11:13:45 +0200 Subject: [PATCH 2/2] Bump version to v4.2.12 (#31491) --- CHANGELOG.md | 8 +++++++- docker-compose.yml | 6 +++--- lib/mastodon/version.rb | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0c05d0d3a020a..b2229f9fdcbfa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,13 @@ All notable changes to this project will be documented in this file. -## |4.2.11] - 2024-08-16 +## [4.2.12] - 2024-08-19 + +### Fixed + +- Fix broken notifications for mentions from local moderators ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/31484)) + +## [4.2.11] - 2024-08-16 ### Added diff --git a/docker-compose.yml b/docker-compose.yml index a599f01e6e5a97..d4d5e89febfa9b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,7 +56,7 @@ services: web: build: . - image: ghcr.io/mastodon/mastodon:v4.2.11 + image: ghcr.io/mastodon/mastodon:v4.2.12 restart: always env_file: .env.production command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" @@ -77,7 +77,7 @@ services: streaming: build: . - image: ghcr.io/mastodon/mastodon:v4.2.11 + image: ghcr.io/mastodon/mastodon:v4.2.12 restart: always env_file: .env.production command: node ./streaming @@ -95,7 +95,7 @@ services: sidekiq: build: . - image: ghcr.io/mastodon/mastodon:v4.2.11 + image: ghcr.io/mastodon/mastodon:v4.2.12 restart: always env_file: .env.production command: bundle exec sidekiq diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 52e1ea540d5693..f0e0554c3f26c4 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -13,7 +13,7 @@ def minor end def patch - 11 + 12 end def default_prerelease