Skip to content

Notify Mastodon apps about received messages - #711

Merged
akirk merged 2 commits into
mainfrom
feature/ema-message-notifications
Sep 4, 2026
Merged

akirk merged 2 commits into
mainfrom
feature/ema-message-notifications

Conversation

@akirk

@akirk akirk commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

Fixes akirk/enable-mastodon-apps#320

A direct message received through a Mastodon app produces no notification, so the only way to notice one is to open the conversations view.

Changes

  • Messages are only exposed to Enable Mastodon Apps through the conversation filters — they were never part of the notification query. They are now registered as a notification source through the mastodon_api_get_notifications_queries filter added in Query every notification source separately enable-mastodon-apps#331, which queries each source on its own. That separation matters here: the query this integration already contributes for cached posts carries a tax_query for the current user's mention tag, and messages don't carry that tag.
  • On an Enable Mastodon Apps release without that filter this is inert, so it can go in independently.
  • A test asserts that the messages are registered as their own source.

Testing instructions

  • With Friends, ActivityPub and Enable Mastodon Apps active, receive a direct message from a friend and open the notifications in a Mastodon app: it now shows up as a mention.
  • Exercised in a disposable WordPress with four things waiting for the user: a comment on their post, a DM in EMA's own DM post type, a cached public mention carrying the mention tag, and a message received through Friends.
=== this branch + EMA with the new filter ===
notifications: 4
  mention  post_type=friend_message      <- new
  mention  post_type=friend_post_cache
  mention  post_type=ema-dm-1
  mention  post_type=comment

=== this branch + EMA main (no new filter) ===
notifications: 1
  mention  post_type=friend_post_cache   <- unchanged from before

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Fixed - for any bug fixes
  • Removed - for now removed features

Message

Notify Mastodon apps about received direct messages.

https://claude.ai/code/session_01CUVxR8uyLTg2roNVWgp91y

Test this PR in WordPress Playground

You can test this pull request directly in WordPress Playground:

Launch WordPress Playground

This will install and activate the plugin with the changes from this PR.

Messages received from a friend showed up in the conversations of a Mastodon
app, but never produced a notification, so there was no way of knowing that one
had arrived without navigating to the conversations.

Register the messages as a notification source through the new
mastodon_api_get_notifications_queries filter. It is queried separately from
the cached posts, whose query needs a tax_query for the mention tag that the
messages don't carry.

Refs akirk/enable-mastodon-apps#320

Claude-Session: https://claude.ai/code/session_01CUVxR8uyLTg2roNVWgp91y
@akirk
akirk merged commit b785ad9 into main Sep 4, 2026
26 checks passed
@akirk
akirk deleted the feature/ema-message-notifications branch September 4, 2026 10:13
@akirk akirk mentioned this pull request Sep 4, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No notification for DMs received when using an enabled Mastodon App

1 participant