Skip to content

Commit

Permalink
statuses working
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Dec 20, 2023
1 parent 6fb8d5b commit efa90c0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ export default function (server: Server, ctx: AppContext) {
limit,
cursor,
})
const subjectStatuses = results.statuses.map(
(status) =>
moderationService.views.formatSubjectStatus({
...status,
handle: '',
}), // @TODO fix handle
const subjectStatuses = results.statuses.map((status) =>
moderationService.views.formatSubjectStatus(status),
)
return {
encoding: 'application/json',
Expand Down
12 changes: 11 additions & 1 deletion packages/ozone/src/services/moderation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,17 @@ export class ModerationService {

const results = await paginatedBuilder.execute()

return { statuses: results, cursor: keyset.packFromResult(results) }
const dids = dedupeStrs(results.map((r) => r.did))
const handlesByDid = await this.getHandlesByDid(dids)
const resultsWithHandles = results.map((r) => ({
...r,
handle: handlesByDid.get(r.did),
}))

return {
statuses: resultsWithHandles,
cursor: keyset.packFromResult(results),
}
}

async isSubjectTakendown(
Expand Down
6 changes: 5 additions & 1 deletion packages/ozone/tests/admin/moderation-statuses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ describe('moderation-statuses', () => {
beforeAll(async () => {
network = await TestNetwork.create({
dbPostgresSchema: 'bsky_moderation_statuses',
ozone: { enabled: true },
})
agent = network.bsky.getClient()
if (!network.ozone) {
throw new Error('Ozone not setup')
}
agent = network.ozone.getClient()
pdsAgent = network.pds.getClient()
sc = network.getSeedClient()
await basicSeed(sc)
Expand Down

0 comments on commit efa90c0

Please sign in to comment.