Skip to content

Return actual user preferences instead of hardcoded values#426

Open
vigneshakaviki wants to merge 1 commit intofedify-dev:mainfrom
vigneshakaviki:fix/preferences-endpoint-hardcoded-values
Open

Return actual user preferences instead of hardcoded values#426
vigneshakaviki wants to merge 1 commit intofedify-dev:mainfrom
vigneshakaviki:fix/preferences-endpoint-hardcoded-values

Conversation

@vigneshakaviki
Copy link
Copy Markdown

@vigneshakaviki vigneshakaviki commented Apr 11, 2026

Summary

The GET /api/v1/preferences endpoint was returning hardcoded default values for all Mastodon preferences, ignoring the user's actual settings stored in the database.

This change reads posting:default:visibility, posting:default:sensitive, and posting:default:language from the authenticated user's account owner and account records instead of returning static defaults.

Fixes #425

What changed

  • Read the authenticated user's accountOwner from the request token
  • Return owner.visibility for posting:default:visibility
  • Return owner.account.sensitive for posting:default:sensitive
  • Return owner.language for posting:default:language
  • Added null check for unauthenticated requests (consistent with other endpoints)
  • reading:expand:media and reading:expand:spoilers remain as defaults since there are no corresponding database columns yet

Test plan

  • TypeScript type check passes (tsc)
  • Biome lint passes (biome check)
  • Verify GET /api/v1/preferences returns actual user settings with a Mastodon client
  • Verify clients like Phanpy correctly pick up the user's configured preferences

Read posting:default:visibility, posting:default:sensitive, and
posting:default:language from the authenticated user's account
settings instead of returning hardcoded defaults from the
GET /api/v1/preferences endpoint.

Fixes fedify-dev#425
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.

Content warnings always collapsed in Phanpy — reading:expand:spoilers appears hardcoded to false

1 participant