Skip to content

Commit

Permalink
♻️ Cleanup linter warnings (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
foysalit authored Dec 5, 2023
1 parent 50c1366 commit 7e74f00
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 85 deletions.
2 changes: 1 addition & 1 deletion packages/bsky/src/services/moderation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ export class ModerationService {
const { did, recordPath } = getStatusIdentifierFromSubject(
'did' in subject ? subject.did : subject.uri,
)
let builder = this.db.db
const builder = this.db.db
.selectFrom('moderation_subject_status')
.where('did', '=', did)
.where('recordPath', '=', recordPath || '')
Expand Down
5 changes: 1 addition & 4 deletions packages/bsky/src/services/moderation/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import { AtUri } from '@atproto/syntax'
import { PrimaryDatabase } from '../../db'
import {
ModerationEvent,
ModerationSubjectStatus,
} from '../../db/tables/moderation'
import { ModerationSubjectStatus } from '../../db/tables/moderation'
import {
REVIEWOPEN,
REVIEWCLOSED,
Expand Down
4 changes: 2 additions & 2 deletions packages/bsky/tests/admin/moderation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ describe('moderation', () => {
createLabelVals: ['nsfw'],
negateLabelVals: [],
})
const { data: takedownAction } = await emitModEvent({
await emitModEvent({
$type: 'com.atproto.admin.defs#modEventTakedown',
})

Expand Down Expand Up @@ -779,7 +779,7 @@ describe('moderation', () => {
negateLabelVals: ModEventLabel['negateLabelVals']
},
) {
const { createLabelVals, negateLabelVals, ...rest } = opts
const { createLabelVals, negateLabelVals } = opts
const result = await agent.api.com.atproto.admin.emitModerationEvent(
{
event: {
Expand Down
151 changes: 73 additions & 78 deletions packages/bsky/tests/views/thread.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,21 @@ describe('pds thread views', () => {

describe('takedown', () => {
it('blocks post by actor', async () => {
const { data: modAction } =
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.admin.defs#repoRef',
did: alice,
},
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.admin.defs#repoRef',
did: alice,
},
)
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
},
)

// Same as shallow post thread test, minus alice
const promise = agent.api.app.bsky.feed.getPostThread(
Expand Down Expand Up @@ -211,22 +210,21 @@ describe('pds thread views', () => {
})

it('blocks replies by actor', async () => {
const { data: modAction } =
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.admin.defs#repoRef',
did: carol,
},
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.admin.defs#repoRef',
did: carol,
},
)
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
},
)

// Same as deep post thread test, minus carol
const thread = await agent.api.app.bsky.feed.getPostThread(
Expand Down Expand Up @@ -255,22 +253,21 @@ describe('pds thread views', () => {
})

it('blocks ancestors by actor', async () => {
const { data: modAction } =
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.admin.defs#repoRef',
did: bob,
},
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.admin.defs#repoRef',
did: bob,
},
)
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
},
)

// Same as ancestor post thread test, minus bob
const thread = await agent.api.app.bsky.feed.getPostThread(
Expand Down Expand Up @@ -300,23 +297,22 @@ describe('pds thread views', () => {

it('blocks post by record', async () => {
const postRef = sc.posts[alice][1].ref
const { data: modAction } =
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.repo.strongRef',
uri: postRef.uriStr,
cid: postRef.cidStr,
},
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.repo.strongRef',
uri: postRef.uriStr,
cid: postRef.cidStr,
},
)
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
},
)

const promise = agent.api.app.bsky.feed.getPostThread(
{ depth: 1, uri: postRef.uriStr },
Expand Down Expand Up @@ -354,23 +350,22 @@ describe('pds thread views', () => {

const parent = threadPreTakedown.data.thread.parent?.['post']

const { data: modAction } =
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.repo.strongRef',
uri: parent.uri,
cid: parent.cid,
},
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
await agent.api.com.atproto.admin.emitModerationEvent(
{
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
subject: {
$type: 'com.atproto.repo.strongRef',
uri: parent.uri,
cid: parent.cid,
},
)
createdBy: 'did:example:admin',
reason: 'Y',
},
{
encoding: 'application/json',
headers: network.pds.adminAuthHeaders(),
},
)

// Same as ancestor post thread test, minus parent post
const thread = await agent.api.app.bsky.feed.getPostThread(
Expand Down Expand Up @@ -407,7 +402,7 @@ describe('pds thread views', () => {
const post1 = threadPreTakedown.data.thread.replies?.[0].post
const post2 = threadPreTakedown.data.thread.replies?.[1].replies[0].post

const actionResults = await Promise.all(
await Promise.all(
[post1, post2].map((post) =>
agent.api.com.atproto.admin.emitModerationEvent(
{
Expand Down

0 comments on commit 7e74f00

Please sign in to comment.