Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement profile API #2926

Merged
merged 3 commits into from
May 29, 2024
Merged

Conversation

VyrCossont
Copy link
Contributor

Description

This Mastodon 4.2 extension provides capabilities missing from the existing Mastodon account update API: deleting an account's avatar or header.

See: https://docs.joinmastodon.org/methods/profile/ and #823

Review notes

This is really an extension of the account API, not a new thing, so I've added it to the account processor. That required the account processor to take a dependency on the media processor as well as the media manager (since the media manager doesn't have the delete-attachment-by-ID functionality we need).

The two new endpoints have nearly identical logic except for which attachment they affect (avatar or header).

Checklist

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have not leveraged AI to create the proposed changes.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

This Mastodon 4.2 extension provides capabilities missing from the existing Mastodon account update API: deleting an account's avatar or header.

See: https://docs.joinmastodon.org/methods/profile/
@tsmethurst
Copy link
Contributor

The dependency stuff feels a bit convoluted, I wonder if it would be good enough to just update the header/avatar media attachment IDs on the account and then let the media cleanup do the actual deletion of the media from storage later on when it does cleanup? I'll double check this when we're back from holiday.

@VyrCossont
Copy link
Contributor Author

Alternatively, we could move account.Processor.deleteProfileAttachment into media.Processor itself. It's sort of on the line between media and accounts, and could fit into either processor.

I'd rather delete the deleted avatar/header media immediately, as that's what the media processor already does when deleting a regular media attachment. The user might expect this in the case of something like uploading the wrong file.

@tsmethurst tsmethurst merged commit 975e92b into superseriousbusiness:main May 29, 2024
2 checks passed
nyarla pushed a commit to nyarla/gotosocial-modded that referenced this pull request Jun 19, 2024
* Implement profile API

This Mastodon 4.2 extension provides capabilities missing from the existing Mastodon account update API: deleting an account's avatar or header.

See: https://docs.joinmastodon.org/methods/profile/

* Move profile media methods to media processor

* Remove check for moved account
nyarla pushed a commit to nyarla/gotosocial-modded that referenced this pull request Jun 19, 2024
* Implement profile API

This Mastodon 4.2 extension provides capabilities missing from the existing Mastodon account update API: deleting an account's avatar or header.

See: https://docs.joinmastodon.org/methods/profile/

* Move profile media methods to media processor

* Remove check for moved account
@VyrCossont VyrCossont deleted the profile-api branch July 26, 2024 23:32
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.

None yet

2 participants