feat: support new Profile API (Mastodon v4.6.0)#1413
Merged
Conversation
Add support for the Mastodon v4.6.0 Profile API: - Add Profile entity type with all documented attributes - Add fetch() and update() methods to ProfileResource - Add UpdateProfileParams for PATCH /api/v1/profile - Add PATCH dispatch handling for profile update - Add multipart-form encoding for profile update (avatar/header uploads) - Update ProfileAvatarResource/ProfileHeaderResource return types from void to AccountCredentials to match API docs - Add missing url field to FeaturedTag entity Closes #1412 Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
commit: |
Contributor
size-limit report 📦
|
The new Profile API support adds ~10 bytes of runtime code to the dispatcher hook (PATCH method + multipart-form encoding for /api/v1/profile). Bump rest and oauth size limits from 4.0 to 4.1 kB. Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
Rails routes both PUT and PATCH to the same update action, so the PATCH override in dispatch() is unnecessary. This keeps the size limits within the original 4.0 kB budget. Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
…htly - Remove unnecessary inferEncoding override for /api/v1/profile since Rails routes both PUT and PATCH to the same update action - Add E2E tests for profile.fetch() and profile.update() - Update compose.yml to use neetshin/mastodon-dev:nightly for Profile API support Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
Update compose.yml to use neetshin/mastodon-dev:4.5.9. Remove profile fetch/update E2E tests since the Profile API (GET/PATCH /api/v1/profile) is not yet available in stable Mastodon releases (planned for v4.6.0). Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
|
This seems to be missing handling for masto.js/src/adapters/action/dispatcher-http-hook-mastodon.ts Lines 39 to 49 in ac170ac I can open another issue if needed 🙇♂️ |
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.
Summary
Adds support for the new Profile API introduced in Mastodon v4.6.0, as requested in #1412.
New entity
Profile(mastodon.v1.Profile) — represents the current user's profile with source values for all editable fields. UnlikeAccount, thenoteandfieldscontain raw unprocessed text (not HTML), andavatar/headerare nullable (null when unset). IncludesfeaturedTags,avatarDescription,headerDescription, and new display preferences (showMedia,showMediaReplies,showFeatured).New methods on
ProfileResourcemasto.v1.profile.fetch()GET /api/v1/profilemasto.v1.profile.update(params)PUT /api/v1/profilemasto.v1.profile.avatar.remove()DELETE /api/v1/profile/avatarmasto.v1.profile.header.remove()DELETE /api/v1/profile/headerOther changes
FeaturedTag: Added missingurlfield per the official docs.ProfileAvatarResource/ProfileHeaderResource: Return type corrected fromvoidtoAccountCredentialsto match the API response.profile.fetch(),profile.update()(display name and fields).compose.yml: Updated docker image toneetshin/mastodon-dev:nightlyfor Profile API support.Usage
Closes #1412
Review & Testing Checklist for Human
neetshin/mastodon-dev:nightlyfrom neetlab/docker-mastodon-dev (after merging thepublish.yamlupdate — see notes below)Profileentity fields match actual API responses from a Mastodon instance running main branchFeaturedTag.urladdition doesn't break existing consumers (it's additive)Notes
neetlab/docker-mastodon-devdirectly, but the required change is minimal — updatepublish.yamlto build from Mastodon'smainbranch instead ofv4.5.3:ref: v${{ env.MASTODON_VERSION }}→ref: ${{ env.MASTODON_REF }}. Both existing patches apply cleanly on main. I have this commit ready at/home/ubuntu/repos/docker-mastodon-devif you'd like me to create a PR from a fork.formatted_noteandformatted_fields(HTML-rendered versions) not yet in official entity docs — can be added in a follow-up.Link to Devin session: https://app.devin.ai/sessions/75d862cffe5041f198449d81888f892b
Requested by: @neet