forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: admin moderation views (bluesky-social#472)
* Model mod actions for actor takedowns * Add administration lex schemas for moderation actions * Initial implementation of takedown mod action and reversal * Refactor admin actions into a service * Check for account takedown when creating new session or refreshing session * Sweep usage of getUser() and getUserByEmail() for takedowns * Begin sweep for account takedowns * Tidy takedown checks * Handle post author takedowns * Fix tests and migrations for mod takedown * Fix xrpc-server delayed read of blob payloads * Test takedown mod action, misc fixes * Remodel lex schemas for admin moderation actions * Remove delcaration cid from actor takedowns, lex schema tidy * Add notes * Move moderation methods to com.atproto, based around repo rather than actor * Moderation reports of repos and records * Implement moderation report resolution method * Tidy * Place moderation-init migration after mute-init * Allow services to reference each other * Model record takedowns in db * Lex schemas for record takedowns * Service/methods for record takedowns, fix report view subject * Apply record takedown to posts in feeds * Test record takedown effects, fix reversal * Support server moderation flag and acknowledge actions, fix action/report resolution for records * Track repo takedowns on repo_root rather than did_handle * Move repo/record reporting under com.atproto.report * Colocate all moderation functionality into moderation service, combine from admin and repo services * Tidy * Tidy * Unify mod report and action methods with new repo/record ref schemas * Schemas for admin moderation views * Tidy/codegen * Fix test snapshot * Break pds admin methods into separate files * Implment admin repo search method * Reorganize existing moderation views into the ModerationViews * Lex schemas for admin get repo/record, implement get repo * Implement admin get record view * Tidy/codegen * Tidy, fix snapshot * Tidy, swap filenames * Implement admin get moderation action view * Implement admin get moderation report view * Implement and test admin views for mod actions and reports * Dry-up some admin and moderation-related seeds in the tests * Fix xrpc fetch usage for newly required duplex option * Admin view of repo and record details (bluesky-social#463) * Reorganize existing moderation views into the ModerationViews * Lex schemas for admin get repo/record, implement get repo * Implement admin get record view * Tidy/codegen * Tidy, fix snapshot
- Loading branch information
Showing
90 changed files
with
6,390 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.getModerationAction", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "View details about a moderation action.", | ||
"parameters": { | ||
"type": "params", | ||
"required": ["id"], | ||
"properties": { | ||
"id": {"type": "number"} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": {"type": "ref", "ref": "com.atproto.admin.moderationAction#viewDetail"} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.getModerationActions", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "List moderation actions related to a subject.", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"subject": {"type": "string"}, | ||
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50}, | ||
"before": {"type": "string"} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["actions"], | ||
"properties": { | ||
"cursor": {"type": "string"}, | ||
"actions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationAction#view"}} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.getModerationReport", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "View details about a moderation report.", | ||
"parameters": { | ||
"type": "params", | ||
"required": ["id"], | ||
"properties": { | ||
"id": {"type": "number"} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": {"type": "ref", "ref": "com.atproto.admin.moderationReport#viewDetail"} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.getModerationReports", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "List moderation reports related to a subject.", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"subject": {"type": "string"}, | ||
"resolved": {"type": "boolean"}, | ||
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50}, | ||
"before": {"type": "string"} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["reports"], | ||
"properties": { | ||
"cursor": {"type": "string"}, | ||
"reports": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationReport#view"}} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.getRecord", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "View details about a record.", | ||
"parameters": { | ||
"type": "params", | ||
"required": ["uri"], | ||
"properties": { | ||
"uri": {"type": "string"}, | ||
"cid": {"type": "string"} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": {"type": "ref", "ref": "com.atproto.admin.record#viewDetail"} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.getRepo", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "View details about a repository.", | ||
"parameters": { | ||
"type": "params", | ||
"required": ["did"], | ||
"properties": { | ||
"did": {"type": "string"} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": {"type": "ref", "ref": "com.atproto.admin.repo#viewDetail"} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.moderationReport", | ||
"defs": { | ||
"view": { | ||
"type": "object", | ||
"required": ["id", "reasonType", "subject", "reportedByDid", "createdAt", "resolvedByActionIds"], | ||
"properties": { | ||
"id": {"type": "integer"}, | ||
"reasonType": {"type": "ref", "ref": "com.atproto.report.reasonType"}, | ||
"reason": {"type": "string"}, | ||
"subject": { | ||
"type": "union", | ||
"refs": [ | ||
"com.atproto.repo.repoRef", | ||
"com.atproto.repo.strongRef" | ||
] | ||
}, | ||
"reportedByDid": {"type": "string"}, | ||
"createdAt": {"type": "datetime"}, | ||
"resolvedByActionIds": {"type": "array", "items": {"type": "integer"}} | ||
} | ||
}, | ||
"viewDetail": { | ||
"type": "object", | ||
"required": ["id", "reasonType", "subject", "reportedByDid", "createdAt", "resolvedByActions"], | ||
"properties": { | ||
"id": {"type": "integer"}, | ||
"reasonType": {"type": "ref", "ref": "com.atproto.report.reasonType"}, | ||
"reason": {"type": "string"}, | ||
"subject": { | ||
"type": "union", | ||
"refs": [ | ||
"com.atproto.admin.repo#view", | ||
"com.atproto.admin.record#view" | ||
] | ||
}, | ||
"reportedByDid": {"type": "string"}, | ||
"createdAt": {"type": "datetime"}, | ||
"resolvedByActions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationAction#view"}} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.record", | ||
"defs": { | ||
"view": { | ||
"type": "object", | ||
"required": ["uri", "cid", "value", "indexedAt", "moderation", "repo"], | ||
"properties": { | ||
"uri": {"type": "string"}, | ||
"cid": {"type": "string"}, | ||
"value": {"type": "unknown"}, | ||
"indexedAt": {"type": "string"}, | ||
"moderation": {"type": "ref", "ref": "#moderation"}, | ||
"repo": {"type": "ref", "ref": "com.atproto.admin.repo#view"} | ||
} | ||
}, | ||
"viewDetail": { | ||
"type": "object", | ||
"required": ["uri", "cid", "value", "indexedAt", "moderation", "repo"], | ||
"properties": { | ||
"uri": {"type": "string"}, | ||
"cid": {"type": "string"}, | ||
"value": {"type": "unknown"}, | ||
"indexedAt": {"type": "string"}, | ||
"moderation": {"type": "ref", "ref": "#moderationDetail"}, | ||
"repo": {"type": "ref", "ref": "com.atproto.admin.repo#view"} | ||
} | ||
}, | ||
"moderation": { | ||
"type": "object", | ||
"required": [], | ||
"properties": { | ||
"takedownId": {"type": "integer"} | ||
} | ||
}, | ||
"moderationDetail": { | ||
"type": "object", | ||
"required": ["actions", "reports"], | ||
"properties": { | ||
"actions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationAction#view"}}, | ||
"reports": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationReport#view"}}, | ||
"takedownId": {"type": "integer"} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.repo", | ||
"defs": { | ||
"view": { | ||
"type": "object", | ||
"required": ["did", "handle", "relatedRecords", "indexedAt", "moderation"], | ||
"properties": { | ||
"did": {"type": "string"}, | ||
"handle": {"type": "string"}, | ||
"account": {"type": "ref", "ref": "#account"}, | ||
"relatedRecords": {"type": "array", "items": {"type": "unknown"}}, | ||
"indexedAt": {"type": "string"}, | ||
"moderation": {"type": "ref", "ref": "#moderation"} | ||
} | ||
}, | ||
"viewDetail": { | ||
"type": "object", | ||
"required": ["did", "handle", "relatedRecords", "indexedAt", "moderation"], | ||
"properties": { | ||
"did": {"type": "string"}, | ||
"handle": {"type": "string"}, | ||
"account": {"type": "ref", "ref": "#account"}, | ||
"relatedRecords": {"type": "array", "items": {"type": "unknown"}}, | ||
"indexedAt": {"type": "string"}, | ||
"moderation": {"type": "ref", "ref": "#moderationDetail"} | ||
} | ||
}, | ||
"account": { | ||
"type": "object", | ||
"required": ["email"], | ||
"properties": { | ||
"email": {"type": "string"} | ||
} | ||
}, | ||
"moderation": { | ||
"type": "object", | ||
"required": [], | ||
"properties": { | ||
"takedownId": {"type": "integer"} | ||
} | ||
}, | ||
"moderationDetail": { | ||
"type": "object", | ||
"required": ["actions", "reports"], | ||
"properties": { | ||
"actions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationAction#view"}}, | ||
"reports": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationReport#view"}}, | ||
"takedownId": {"type": "integer"} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.searchRepos", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "Find repositories based on a search term.", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"term": {"type": "string"}, | ||
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50}, | ||
"before": {"type": "string"} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["repos"], | ||
"properties": { | ||
"cursor": {"type": "string"}, | ||
"repos": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.repo#view"}} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.