Skip to content

Commit

Permalink
Update deactivation through updateSubjectStatus (bluesky-social#2539)
Browse files Browse the repository at this point in the history
* attach hosting status to entryway session responses

* integrate account deactivation in with entryway

* tidy

* tidy

* chnageset

* update changeset
  • Loading branch information
dholms authored Jun 4, 2024
1 parent c5d36d5 commit 9495af2
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/thirty-dolls-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@atproto/api": patch
"@atproto/pds": patch
"@atproto/dev-env": patch
---

Allow updating deactivation state through admin.updateSubjectStatus
4 changes: 4 additions & 0 deletions lexicons/com/atproto/admin/updateSubjectStatus.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
"takedown": {
"type": "ref",
"ref": "com.atproto.admin.defs#statusAttr"
},
"deactivated": {
"type": "ref",
"ref": "com.atproto.admin.defs#statusAttr"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface InputSchema {
| ComAtprotoAdminDefs.RepoBlobRef
| { $type: string; [k: string]: unknown }
takedown?: ComAtprotoAdminDefs.StatusAttr
deactivated?: ComAtprotoAdminDefs.StatusAttr
[k: string]: unknown
}

Expand Down
4 changes: 4 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface InputSchema {
| ComAtprotoAdminDefs.RepoBlobRef
| { $type: string; [k: string]: unknown }
takedown?: ComAtprotoAdminDefs.StatusAttr
deactivated?: ComAtprotoAdminDefs.StatusAttr
[k: string]: unknown
}

Expand Down
4 changes: 4 additions & 0 deletions packages/ozone/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface InputSchema {
| ComAtprotoAdminDefs.RepoBlobRef
| { $type: string; [k: string]: unknown }
takedown?: ComAtprotoAdminDefs.StatusAttr
deactivated?: ComAtprotoAdminDefs.StatusAttr
[k: string]: unknown
}

Expand Down
12 changes: 11 additions & 1 deletion packages/pds/src/api/com/atproto/admin/updateSubjectStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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: {
Expand Down
4 changes: 4 additions & 0 deletions packages/pds/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface InputSchema {
| ComAtprotoAdminDefs.RepoBlobRef
| { $type: string; [k: string]: unknown }
takedown?: ComAtprotoAdminDefs.StatusAttr
deactivated?: ComAtprotoAdminDefs.StatusAttr
[k: string]: unknown
}

Expand Down

0 comments on commit 9495af2

Please sign in to comment.