Skip to content

Return actual user preferences instead of hardcoded values#426

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

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
Contributor

@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
@vigneshakaviki
Copy link
Copy Markdown
Contributor Author

Friendly ping — any feedback on this one? Happy to make changes if needed.

@dahlia dahlia self-assigned this May 5, 2026
@dahlia dahlia added bug Something isn't working enhancement New feature or request labels May 5, 2026
@dahlia dahlia force-pushed the fix/preferences-endpoint-hardcoded-values branch from 73d254e to ba4256e Compare May 5, 2026 09:08
dahlia added a commit to vigneshakaviki/hollo that referenced this pull request May 5, 2026
@dahlia dahlia force-pushed the fix/preferences-endpoint-hardcoded-values branch from ba4256e to 73d254e Compare May 5, 2026 09:10
@dahlia
Copy link
Copy Markdown
Member

dahlia commented May 5, 2026

Fixed in e30fa49.

@dahlia dahlia closed this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

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

2 participants