Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See https://community.openstreetmap.org/t/is-this-the-same-person/123461/30
Problem: how an app accessing OSM API can determine that the current user is blocked, and tell them that they're blocked? Here's a method I came up with: streetcomplete/StreetComplete#6062 (comment). It has two hacky steps:
/api/0.6/user/#id
without auth header, because/api/0.6/user/details
is inaccessible while blockedSome people access an endpoint that is known to generate 403 errors only when blocked instead of 1, but there's no guarantee that things will stay that way.
/api/0.6/user/#id
may also become inaccessible without authorization in the future. This PR does 1 in an unambiguous way by providing an endpoint that lists active blocks for the current user. It it accessible even if the user is blocked.GET user/blocks/active
outputs a list of<user_block>
elements like #4240. Currently I'm skipping block reason texts because I'm making this similar to Messages API which also skips message texts in lists. While this list is short and adding reasons wouldn't make the results very long, we may add a similar list of all blocks / by all users and it will get long.I probably should add a limit but I can't imagine anyone collecting a lot of active blocks. More than one is already unusual.
user/blocks/active
requiresread_prefs
scope, which may look strange, but that's because this scope is also responsible for user identity. Similarlyuser/details
requiresread_prefs
despite not reading preferences.