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/app/services/notify_service.rb b/app/services/notify_service.rb index be9a88af45c52f..57305aaa47c870 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -89,7 +89,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/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 c6a630cf90f006..63d651249e28f0 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -25,7 +25,7 @@ def minor end def patch - 11 + 12 end def default_prerelease 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)