Repository navigation
Reply, Favourite and Boost buttons on mention notifications - #31
Merged
Merged
Conversation
Mastodon's Web Push payload carries the notification id and the account's access token. A new core command, push_action, finds the account by that token, looks up the notification's post (GET /api/v1/notifications/:id) and favourites, boosts or replies to it, with the same mentions and visibility as a reply from the timeline. It loads the accounts itself when the core was never started, so it works with the app closed. On Android, mention and status pushes get the three buttons; Reply takes typed text through RemoteInput. PushActionReceiver runs a short-lived core for the press and toasts the outcome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
FastSMRW's Android notifications have no buttons.
FastSmMessagingService.showbuilds them with only a content intent. Screen-reader users who handle notifications from the shade, or from a launcher that exposes notification actions, can't reply to or react to a mention without opening the app. Other Mastodon clients offer these buttons.What
Core (all logic stays here, per CLAUDE.md):
SocialAccount::owns_access_token(token)andSocialAccount::notification_status(id), implemented for Mastodon.notification_statuscallsGET /api/v1/notifications/:idand maps itsstatus.push_action:{access_token, notification_id, action: "favourite"|"boost"|"reply", text?}returnspush_action_result {ok, action, notification_id}.access_tokenandnotification_id, so the button acts as the account the push was sent to.PostDraftthe way a timeline reply does. It usespresent::mention_prefixand keeps the post's visibility, so a DM stays a DM.push_actionloads the accounts asstartdoes but builds no timelines.test_push_actionintests/test_push.cppcovers:in_reply_to_id,visibility=directand the mentionAndroid:
mentionandstatusget Reply (RemoteInput), Favourite and Boost buttons.PushActionReceiver(not exported):FastSmCorefor the press, sendspush_actionand waits up to 8 s insidegoAsyncdocs/changelog.txt: one line.Not done: iOS parity
iOS already registers a category per push type with
actions: [](PushManager.swift). AddingUNNotificationActions that send the samepush_actioncommand would give parity. I can't build or test iOS here, so I left it for you rather than ship untested Swift. I can add it if you want it in this PR.Testing
assembleDebugbuilds, which compiles the core changes for both ABIs.build.bat teston Windows, sotest_push_actionis written but has never been compiled into the test binary or executed.google-services.json, so real pushes can't arrive. For the test only, I made the receiver exported in an uncommittedsrc/debugmanifest and sent its broadcast with adb.favouritenotification about the account's own post: the server reportedfavourited: trueabout a second later. The favourite was then undone.Notes
SoundManager's constructor. During a button press that opens a silent output stream for about a second (Samsung logs "background playback would be muted"). Nothing is heard. A lazy engine start would avoid it if you'd prefer.config.jsonand never saves it; it does append a few lines tofastsm.log, as every core does.🤖 Generated with Claude Code