Update deactivation through updateSubjectStatus ()

* attach hosting status to entryway session responses

* integrate account deactivation in with entryway

* tidy

* tidy

* chnageset

* update changeset
This commit is contained in:
Daniel Holmgren 2024-06-04 10:33:47 -05:00 committed by GitHub
parent c5d36d5ba2
commit 9495af23bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 42 additions and 1 deletions
.changeset
lexicons/com/atproto/admin
packages
api/src/client
lexicons.ts
types/com/atproto/admin
bsky/src/lexicon
lexicons.ts
types/com/atproto/admin
ozone/src/lexicon
lexicons.ts
types/com/atproto/admin
pds/src
api/com/atproto/admin
lexicon
lexicons.ts
types/com/atproto/admin

@ -0,0 +1,7 @@
---
"@atproto/api": patch
"@atproto/pds": patch
"@atproto/dev-env": patch
---
Allow updating deactivation state through admin.updateSubjectStatus

@ -22,6 +22,10 @@
"takedown": {
"type": "ref",
"ref": "com.atproto.admin.defs#statusAttr"
},
"deactivated": {
"type": "ref",
"ref": "com.atproto.admin.defs#statusAttr"
}
}
}

@ -535,6 +535,10 @@ export const schemaDict = {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
deactivated: {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
},
},
},

@ -18,6 +18,7 @@ export interface InputSchema {
| ComAtprotoAdminDefs.RepoBlobRef
| { $type: string; [k: string]: unknown }
takedown?: ComAtprotoAdminDefs.StatusAttr
deactivated?: ComAtprotoAdminDefs.StatusAttr
[k: string]: unknown
}

@ -535,6 +535,10 @@ export const schemaDict = {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
deactivated: {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
},
},
},

@ -19,6 +19,7 @@ export interface InputSchema {
| ComAtprotoAdminDefs.RepoBlobRef
| { $type: string; [k: string]: unknown }
takedown?: ComAtprotoAdminDefs.StatusAttr
deactivated?: ComAtprotoAdminDefs.StatusAttr
[k: string]: unknown
}

@ -535,6 +535,10 @@ export const schemaDict = {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
deactivated: {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
},
},
},

@ -19,6 +19,7 @@ export interface InputSchema {
| ComAtprotoAdminDefs.RepoBlobRef
| { $type: string; [k: string]: unknown }
takedown?: ComAtprotoAdminDefs.StatusAttr
deactivated?: ComAtprotoAdminDefs.StatusAttr
[k: string]: unknown
}

@ -13,7 +13,7 @@ export default function (server: Server, ctx: AppContext) {
server.com.atproto.admin.updateSubjectStatus({
auth: ctx.authVerifier.moderator,
handler: async ({ input }) => {
const { subject, takedown } = input.body
const { subject, takedown, deactivated } = input.body
if (takedown) {
if (isRepoRef(subject)) {
await ctx.accountManager.takedownAccount(subject.did, takedown)
@ -36,6 +36,16 @@ export default function (server: Server, ctx: AppContext) {
}
}
if (deactivated) {
if (isRepoRef(subject)) {
if (deactivated.applied) {
await ctx.accountManager.deactivateAccount(subject.did, null)
} else {
await ctx.accountManager.activateAccount(subject.did)
}
}
}
return {
encoding: 'application/json',
body: {

@ -535,6 +535,10 @@ export const schemaDict = {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
deactivated: {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
},
},
},

@ -19,6 +19,7 @@ export interface InputSchema {
| ComAtprotoAdminDefs.RepoBlobRef
| { $type: string; [k: string]: unknown }
takedown?: ComAtprotoAdminDefs.StatusAttr
deactivated?: ComAtprotoAdminDefs.StatusAttr
[k: string]: unknown
}