Skip to content

Fix quote_approval_policy being reset to user defaults when omitted in status update#37436

Merged
ClearlyClaire merged 2 commits intomastodon:mainfrom
shleeable:patch-34
Jan 13, 2026
Merged

Fix quote_approval_policy being reset to user defaults when omitted in status update#37436
ClearlyClaire merged 2 commits intomastodon:mainfrom
shleeable:patch-34

Conversation

@shleeable
Copy link
Contributor

@shleeable shleeable commented Jan 9, 2026

I've confirmed this is an issue with the API logic and the web frontend correctly supplies the value. (No need for documentation to be updated)

Validation test

## CREATE WITH NOBODY QUOTE

  ~ curl -sS -X POST "https://aus.social/api/v1/statuses" \
  -H "Authorization: Bearer xxxxxx" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"status":"Original text","quote_approval_policy":"nobody"}'

{"id":"115865366667286038","created_at":"2026-01-09T13:26:29.626Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"https://aus.social/users/shlee/statuses/115865366667286038","url":"https://aus.social/@shlee/115865366667286038","replies_count":0,"reblogs_count":0,"favourites_count":0,"quotes_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eOriginal text\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"bullshit","website":null},"account":xxxxxx"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"quote":null,"card":null,"poll":null,"quote_approval":{"automatic":[],"manual":[],"current_user":"automatic"}}%

## UPDATE WITH NO POLICY CHANGE

➜  ~ curl -X PUT "https://aus.social/api/v1/statuses/115865366667286038" \
  -H "Authorization: Bearer xxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "Updated text"
  }'
{"id":"115865366667286038","created_at":"2026-01-09T13:26:29.626Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"https://aus.social/users/shlee/statuses/115865366667286038","url":"https://aus.social/@shlee/115865366667286038","replies_count":0,"reblogs_count":0,"favourites_count":1,"quotes_count":0,"edited_at":"2026-01-09T13:27:10.474Z","favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eUpdated text\u003c/p\u003e","filtered":[],"reblog":null,"application":xxxxxxxxxx,"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"quote":null,"card":null,"poll":null,"quote_approval":{"automatic":["public"],"manual":[],"current_user":"automatic"}}%

## POLICY IS CHANGED!

curl -s "https://aus.social/api/v1/statuses/115865366667286038" \
  -H "Authorization: Bearer xxxxxxxx" | jq '.quote_approval'

{
  "automatic": [
    "public"
  ],
  "manual": [],
  "current_user": "automatic"
}

@shleeable
Copy link
Contributor Author

The webui update includes the value
image

@mjankowski
Copy link
Contributor

Would be good to add a spec showing the previously broken behavior here so we dont add regression at some point.

I suspect what's happening here is in this concern - https://github.com/mastodon/mastodon/blob/v4.5.4/app/controllers/concerns/api/interaction_policies_concern.rb#L7 - the logic of "use the param if supplied, and the user default if not" makes sense when we create for the first time, but not on update.

We may be able to find a more elegant way to remove that one item from the update hash...

@shleeable
Copy link
Contributor Author

I am not smart enough to write specs.

@shleeable
Copy link
Contributor Author

@ClearlyClaire please review as this is quote related.

@ClearlyClaire
Copy link
Contributor

This behavior is documented as “if omitted, it will use the user’s default settings” in https://docs.joinmastodon.org/client/quotes/, but I agree this is a foot-gun, and it is not consistently documented.

@ClearlyClaire ClearlyClaire added the to backport PR needed to be backported label Jan 13, 2026
@ClearlyClaire ClearlyClaire changed the title Status update overwrites quote_approval_policy when parameter is omitted Fix quote_approval_policy being reset to user defaults when omitted in status update Jan 13, 2026
@ClearlyClaire
Copy link
Contributor

I think this is more of a bugfix than an API change as the current behavior is poorly documented, and while it should not affect clients aware of quote posts, it can definitely affect users with clients that are not aware of it. Marked as to be backported.

@ClearlyClaire ClearlyClaire added this pull request to the merge queue Jan 13, 2026
Merged via the queue into mastodon:main with commit 9b5986b Jan 13, 2026
35 checks passed
@shleeable shleeable deleted the patch-34 branch January 13, 2026 13:57
ClearlyClaire pushed a commit that referenced this pull request Jan 16, 2026
ClearlyClaire pushed a commit that referenced this pull request Jan 19, 2026
@ClearlyClaire ClearlyClaire removed the to backport PR needed to be backported label Jan 19, 2026
mistydemeo pushed a commit to mistydemeo/mastodon that referenced this pull request Jan 20, 2026
kmycode pushed a commit to kmycode/mastodon that referenced this pull request Jan 20, 2026
mimikun pushed a commit to mimikun/mastodon that referenced this pull request Jan 23, 2026
mimikun pushed a commit to mimikun/mastodon that referenced this pull request Jan 23, 2026
mo-rijndael pushed a commit to mastodon-ml/mastodon that referenced this pull request Jan 25, 2026
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.

3 participants

Comments