Skip to content

fix(users): apply allow_friend_requests from the edit payload - #8323

Closed
ha-am-dev wants to merge 1 commit into
modrinth:mainfrom
ha-am-dev:fix/user-allow-friend-requests
Closed

ha-am-dev wants to merge 1 commit into
modrinth:mainfrom
ha-am-dev:fix/user-allow-friend-requests

Conversation

@ha-am-dev

Copy link
Copy Markdown

fix(users): apply allow_friend_requests from the edit payload

What

PATCH /v3/user/{id} reads user.allow_friend_requests (the authenticated caller's
current value) when building the update, so the field is never taken from the request
body.

Why it matters

  • A user cannot turn friend requests off (or back on). The update writes back the
    value they already had.
  • When a staff member edits another account, their own value is copied onto that
    account instead of the value in the payload.

Change

-            if let Some(allow_friend_requests) = &user.allow_friend_requests {
+            if let Some(allow_friend_requests) = &new_user.allow_friend_requests {

new_user is the EditUser payload already deserialised by the handler; the other
fields in the same block use it the same way.

Testing

  • PATCH /v3/user/{id} with {"allow_friend_requests": false} as the owner, then
    read the user preferences and assert the stored value changed.
  • Same request as a moderator against another account, asserting the target account
    receives the payload value, not the moderator's.

@github-actions

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@mergify

mergify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

This pull request is closed, so it cannot be queued. Reopen it to get the box back.

@Prospector Prospector closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants