-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add purge labels on takedown * wire up some cfg * tests * fix up tests * purge -> takedown * Temporary unspecced labels relating takedowns in ozone (#2101) temporarily move to unspecced labels relating takedowns --------- Co-authored-by: devin ivy <devinivy@gmail.com>
- Loading branch information
Showing
10 changed files
with
286 additions
and
114 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
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 |
---|---|---|
@@ -1,29 +1,44 @@ | ||
import { Server } from '../../lexicon' | ||
import AppContext from '../../context' | ||
import { | ||
UNSPECCED_TAKEDOWN_BLOBS_LABEL, | ||
UNSPECCED_TAKEDOWN_LABEL, | ||
} from '../../mod-service/types' | ||
|
||
export default function (server: Server, ctx: AppContext) { | ||
server.com.atproto.temp.fetchLabels(async ({ params }) => { | ||
const { limit } = params | ||
const since = | ||
params.since !== undefined ? new Date(params.since).toISOString() : '' | ||
const labelRes = await ctx.db.db | ||
.selectFrom('label') | ||
.selectAll() | ||
.orderBy('label.cts', 'asc') | ||
.where('cts', '>', since) | ||
.limit(limit) | ||
.execute() | ||
server.com.atproto.temp.fetchLabels({ | ||
auth: ctx.authOptionalAccessOrRoleVerifier, | ||
handler: async ({ auth, params }) => { | ||
const { limit } = params | ||
const since = | ||
params.since !== undefined ? new Date(params.since).toISOString() : '' | ||
const includeUnspeccedTakedowns = | ||
auth.credentials.type === 'role' && auth.credentials.admin | ||
const labelRes = await ctx.db.db | ||
.selectFrom('label') | ||
.selectAll() | ||
.orderBy('label.cts', 'asc') | ||
.where('cts', '>', since) | ||
.if(!includeUnspeccedTakedowns, (q) => | ||
q.where('label.val', 'not in', [ | ||
UNSPECCED_TAKEDOWN_LABEL, | ||
UNSPECCED_TAKEDOWN_BLOBS_LABEL, | ||
]), | ||
) | ||
.limit(limit) | ||
.execute() | ||
|
||
const labels = labelRes.map((l) => ({ | ||
...l, | ||
cid: l.cid === '' ? undefined : l.cid, | ||
})) | ||
const labels = labelRes.map((l) => ({ | ||
...l, | ||
cid: l.cid === '' ? undefined : l.cid, | ||
})) | ||
|
||
return { | ||
encoding: 'application/json', | ||
body: { | ||
labels, | ||
}, | ||
} | ||
return { | ||
encoding: 'application/json', | ||
body: { | ||
labels, | ||
}, | ||
} | ||
}, | ||
}) | ||
} |
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
Oops, something went wrong.