-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Allow appeals on takendown account (#3251)
* ✨ Allow appeals on takendown account * ✅ Update snapshot * ✅ Remove duplicate test * ✨ Respond with takendown token from createSession for takendown accounts * 🧹 cleanup appeal account action stuff * 📝 Add description to new field * ♻️ Refactor authscope formatter and add test for create record with takendown token * ✅ Update snapshot * add createReport route * changeset --------- Co-authored-by: dholms <[email protected]>
- Loading branch information
Showing
23 changed files
with
354 additions
and
29 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,5 @@ | ||
--- | ||
"@atproto/pds": patch | ||
--- | ||
|
||
Allow takendown account scope on access tokens. Allow takendown accounts to createReports at discretion of the moderation service |
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,5 @@ | ||
--- | ||
"@atproto/api": patch | ||
--- | ||
|
||
Allow createSession to request takendown account scope |
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
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
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
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
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
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
36 changes: 36 additions & 0 deletions
36
packages/pds/src/api/com/atproto/moderation/createReport.ts
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,36 @@ | ||
import { Server } from '../../../../lexicon' | ||
import AppContext from '../../../../context' | ||
import { parseProxyInfo } from '../../../../pipethrough' | ||
import { ids } from '../../../../lexicon/lexicons' | ||
import { AtpAgent } from '@atproto/api' | ||
import { AuthScope } from '../../../../auth-verifier' | ||
|
||
export default function (server: Server, ctx: AppContext) { | ||
server.com.atproto.moderation.createReport({ | ||
auth: ctx.authVerifier.accessStandard({ | ||
additional: [AuthScope.Takendown], | ||
}), | ||
handler: async ({ auth, input, req }) => { | ||
const { url, did: aud } = await parseProxyInfo( | ||
ctx, | ||
req, | ||
ids.ComAtprotoModerationCreateReport, | ||
) | ||
const agent = new AtpAgent({ service: url }) | ||
const serviceAuth = await ctx.serviceAuthHeaders( | ||
auth.credentials.did, | ||
aud, | ||
ids.ComAtprotoModerationCreateReport, | ||
) | ||
const res = await agent.com.atproto.moderation.createReport(input.body, { | ||
...serviceAuth, | ||
encoding: 'application/json', | ||
}) | ||
|
||
return { | ||
encoding: 'application/json', | ||
body: res.data, | ||
} | ||
}, | ||
}) | ||
} |
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,7 @@ | ||
import AppContext from '../../../../context' | ||
import { Server } from '../../../../lexicon' | ||
import createReport from './createReport' | ||
|
||
export default function (server: Server, ctx: AppContext) { | ||
createReport(server, ctx) | ||
} |
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
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
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
30 changes: 30 additions & 0 deletions
30
packages/pds/tests/__snapshots__/takedown-appeal.test.ts.snap
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 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`appeal account takedown actor takedown allows appeal request. 1`] = ` | ||
Object { | ||
"appealed": true, | ||
"createdAt": "1970-01-01T00:00:00.000Z", | ||
"hosting": Object { | ||
"$type": "tools.ozone.moderation.defs#accountHosting", | ||
"status": "unknown", | ||
}, | ||
"id": 1, | ||
"lastAppealedAt": "1970-01-01T00:00:00.000Z", | ||
"lastReportedAt": "1970-01-01T00:00:00.000Z", | ||
"lastReviewedAt": "1970-01-01T00:00:00.000Z", | ||
"lastReviewedBy": "user(0)", | ||
"reviewState": "tools.ozone.moderation.defs#reviewEscalated", | ||
"subject": Object { | ||
"$type": "com.atproto.admin.defs#repoRef", | ||
"did": "user(1)", | ||
}, | ||
"subjectBlobCids": Array [], | ||
"subjectRepoHandle": "jeff.test", | ||
"tags": Array [ | ||
"lang:und", | ||
"report:appeal", | ||
], | ||
"takendown": true, | ||
"updatedAt": "1970-01-01T00:00:00.000Z", | ||
} | ||
`; |
Oops, something went wrong.