Skip to content

Add mastodon.update_profile action to Mastodon integration#167444

Merged
allenporter merged 6 commits into
home-assistant:devfrom
tr4nt0r:masto_update_profile
Apr 5, 2026
Merged

Add mastodon.update_profile action to Mastodon integration#167444
allenporter merged 6 commits into
home-assistant:devfrom
tr4nt0r:masto_update_profile

Conversation

@tr4nt0r
Copy link
Copy Markdown
Contributor

@tr4nt0r tr4nt0r commented Apr 5, 2026

Proposed change

Adds an action to update profile information and pictures

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented Apr 5, 2026

Hey there @fabaff, @andrew-codechimp, mind taking a look at this pull request as it has been labeled with an integration (mastodon) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of mastodon can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign mastodon Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new mastodon.update_profile service action to the Mastodon integration, allowing users to update their profile information including display name, bio, profile pictures, and additional profile fields.

Changes:

  • Added the update_profile service implementation with support for updating display name, bio, avatar, header, locked status, bot flag, discoverable status, profile fields, and attribution domains
  • Added YAML anchor/alias refactoring for the config_entry_id field to reduce duplication across service definitions
  • Added service strings and translations for the new action and profile fields selector
  • Added service icon for the new action

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
homeassistant/components/mastodon/services.py Added _async_update_profile service handler and _resolve_media helper function for media resolution
homeassistant/components/mastodon/services.yaml Added update_profile service schema definition and refactored config_entry_id field as YAML anchor
homeassistant/components/mastodon/strings.json Added translations for the new service, profile fields selector, and field descriptions
homeassistant/components/mastodon/icons.json Added icon definition for the new update_profile service

Comment thread homeassistant/components/mastodon/services.py
Comment thread homeassistant/components/mastodon/strings.json
Comment thread homeassistant/components/mastodon/services.py Outdated
Comment thread homeassistant/components/mastodon/services.py
Copilot AI review requested due to automatic review settings April 5, 2026 16:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread tests/components/mastodon/test_services.py Outdated
Comment thread tests/components/mastodon/test_services.py Outdated
Comment thread tests/components/mastodon/test_services.py Outdated
@tr4nt0r tr4nt0r marked this pull request as ready for review April 5, 2026 16:36
@tr4nt0r tr4nt0r requested a review from fabaff as a code owner April 5, 2026 16:36
Copilot AI review requested due to automatic review settings April 5, 2026 16:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Comment thread homeassistant/components/mastodon/strings.json Outdated
get_account:
fields:
config_entry_id:
config_entry_id: &config_entry_id
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with this syntax but all others you've changed are using *config_entry_id

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is anchor to which all others are referencing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh that's neat.

SERVICE_UPDATE_PROFILE,
_async_update_profile,
schema=SERVICE_UPDATE_PROFILE_SCHEMA,
supports_response=SupportsResponse.ONLY,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we expecting a response on this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The APIs response is the updated Account data

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, could be useful.
I wonder if we should trigger a coordinator refresh on success, otherwise the entities will be out of date and they have a fairly long poll period.

@allenporter allenporter merged commit a084e85 into home-assistant:dev Apr 5, 2026
33 checks passed
@tr4nt0r tr4nt0r deleted the masto_update_profile branch April 5, 2026 23:10
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants