-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose report categories via API #30301
Comments
An initial draft implementation exists in #30300 |
AIUI, the report categories are enumerated in the API description for https://docs.joinmastodon.org/methods/reports/#post. Although that documentation appears to be out of date, as it lists 4 categories, and performing a test report through the web UI shows 5 categories. Would updating the documentation solve this specific case? Is supporting a general "A server might introduce it's own report categories, and clients should be able to discover what those are and show localised UI text" a different problem? |
@nikclayton it's actually correct!
The top option "I just don't like this" is not really a report category, it's a fake option that takes you to block/mute options: There's only legal, spam, violation and other; violation is only present if the instance has rules to violate. (Though there's certainly interest in more categories! And we have added categories over time as required)
It's in this discussion. See the PR I linked, or the issue description. If we want the server to give a user-localised response, it can't be in the instance info endpoint (which is public / cached), so we'd need a new endpoint somewhere for it. |
For further reference, here's Feditext's report screen. Feditext fetches the server software name and version from the NodeInfo doc, and has a hardcoded list of which Mastodon-like servers support which report API parameters, including which report categories are supported. This list has to be updated periodically, every time Mastodon adds a category (or Feditext adds support for another Mastodon-like server). Rules are pulled from the instance itself and displayed when the Just listing report category enum values won't help much. If I want to show anything other than the raw enum value, I still need to know what the possible values are (from Mastodon API docs) when I ship the app so I can localize strings for them ahead of time, or I need to be able to get localized values in my app locale from the instance server. It'd be only middlingly useful to have an API to fetch both a list of acceptable category enum values and their localized names in a requested locale. If categories don't change that often, it's actually more work to fetch and cache the results of a report categories API endpoint than it is to use my existing localization mechanisms and update whenever Mastodon updates the report endpoint. Version rules are unfortunately already a necessity when dealing with the Mastodon API. However, the category and localized name API would be necessary if you're planning on allowing admins to customize the list of accepted categories. It'd also be good for the API ecosystem, since it offers a way for Mastodon forks or Mastodon-compatible servers to extend the list of categories. It'd be even more useful to be able to get localized versions of instance-specific strings. @ThisIsMissEm brought up instance rules as one example; I'd also like to be able to get a localized instance description or extended description, and localized role names. Localized supported posting languages and supported translation languages would also be handy. |
Pitch
Currently many clients do not implement the correct categorization of Reports that are created, generally only allowing reporting of rule violations. I suspect this is because there's no API through which to request back the report categories which are defined as an enum on the Report model.
We could either expose just the enum key (which is used for subsequent requests), or we could localise the response (category, title, description).
Motivation
Having the report categories available via API would enable clients to dynamically display the report categories, and allow picking from those, and then if the category is "violation" then show the "rule violated selector" UI.
This should improve reports received from Mobile apps.
The text was updated successfully, but these errors were encountered: