-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add moderation API #9387
Add moderation API #9387
Conversation
f91b4fd
to
5e8c2ba
Compare
@Gargron is it possible to add a parameter in Account entity like "is_moderator" to display moderation features only if needed? |
d440477
to
bf3fbbe
Compare
a2459eb
to
79fb2b4
Compare
This is still far from everything that admins can do through the website. However, it should be possible to automate the most pressing tasks with this: Approval of pending accounts and auto-modding of reports. What is not yet possible but could be important as part of auto-modding applications is modifying statuses, such as updating |
Great stuff, thanks! This should help with Fedi's still-at-large spam problem. One thing I can think of that could be added is the ability to get recently created accounts and their posts, so that an automated script could pull them and screen their posts to ensure they aren't following common spam patterns. |
Can |
It's supported I forgot to list it.
Accounts returned from the accounts API are ordered by recent-first. The non-admin REST API could be used to retrieve those accounts' posts, I believe. |
Endpoints to manage federation (e.g. suspending instances) would be nice to have, if they aren't already a thing. |
I concur, but would argue that's not something most people would not want to be doing from a mobile app or automated script, at least with the current state of the Fediverse. |
@bclindner I'm sure it would be nice to have regardless; what I had in mind when suggesting that was the ability to write a small CLI script to let me suspend an instance from my terminal window instead of having to jump through hoops in the web interface. |
@slice I'm sure a new |
@Gargron Yeah, |
moderation note missing? |
@Gargron does |
It's easy to get the entity Account for the reported one (ie via statuses->getAccount) but for the account who reports, it needs an extra call from account_id. Would it be possible to attach Account entities inside the report entity? |
Okay, that will make the API a bit slower, though. I was even considering GraphQL for this to avoid sending unnecessary attributes and entities but I guess it'd be kinda weird to add GraphQL just for the admin parts of the API. |
79fb2b4
to
c60dcff
Compare
Okay, that information is now included in the reports API. This kind of makes sense too because it means you can give an app access to reports only and it will be able to see data of reported accounts only. |
c60dcff
to
1cce5d7
Compare
1cce5d7
to
ed359f0
Compare
@Gargron If you are interested in developing a GraphQL API to mastodon, please drop me a message, and I'd be happy to help with the schema design & implementation. (Though it could also be a standalone component like the real-time service, which would also then support GraphQL Subscriptions) |
@Gargron, does this support marking media as sensitive or removing images or other media? (I'm looking at this thinking it can't be that hard to add, but it's been a while since I've contributed) |
I would also be interested in helping with a GraphQL API. i know this ticket is closed, but i would love to help. @ThisIsMissEm && @Gargron |
@Gargron , are there APIs to DELETE and SENSITIVE the post(s) attached to the reported user? These actions can be done from the web UI but I could not find an API for this. |
@aakritichoudhary there isn't currently. There's also not an API to fetch all moderators on a server. Consider opening new feature requests for these? |
GET /api/v1/admin/accounts
local
,remote
,by_domain
,active
,pending
,disabled
,silenced
,suspended
,username
,display_name
,email
,ip
,staff
GET /api/v1/admin/accounts/:id
POST /api/v1/admin/accounts/:id/enable
POST /api/v1/admin/accounts/:id/approve
POST /api/v1/admin/accounts/:id/reject
POST /api/v1/admin/accounts/:id/unsilence
POST /api/v1/admin/accounts/:id/unsuspend
GET /api/v1/admin/reports
resolved
,account_id
,target_account_id
GET /api/v1/admin/reports/:id
POST /api/v1/admin/reports/:id/assign_to_self
POST /api/v1/admin/reports/:id/unassign
POST /api/v1/admin/reports/:id/reopen
POST /api/v1/admin/reports/:id/resolve
POST /api/v1/admin/accounts/:id/action
type
,report_id
,warning_preset_id
,text
,send_email_notification
JSON returned from accounts APIs includes
id
,username
,domain
,created_at
,email
,role
,ip
,confirmed
,suspended
,silenced
,disabled
,approved
, andaccount
which renders the standard account data used in the rest of the application. Additionally, there arelocale
,invite_request
,created_by_application_id
andinvited_by_account_id
JSON returns from reports APIs includes
id
,action_taken
,comment
,created_at
,updated_at
,account_id
,target_account_id
,assigned_account_id
,action_taken_by_account_id
, andstatuses
which renders the standard status data used in the rest of the application.