Hackfix to translate gore labels to graphic-media

This commit is contained in:
Paul Frazee
2024-03-13 12:49:26 -07:00
parent 3679852e17
commit 6d0ac69a23
+20 -6
View File
@@ -1,9 +1,4 @@
import {moderatePost} from '@atproto/api' import {moderatePost, BSKY_LABELER_DID} from '@atproto/api'
// TODO
// do we think we'll need this again?
// if not we can ditch it!
// -prf
type ModeratePost = typeof moderatePost type ModeratePost = typeof moderatePost
type Options = Parameters<ModeratePost>[1] type Options = Parameters<ModeratePost>[1]
@@ -12,5 +7,24 @@ export function moderatePost_wrapped(
subject: Parameters<ModeratePost>[0], subject: Parameters<ModeratePost>[0],
opts: Options, opts: Options,
) { ) {
// HACK
// temporarily translate 'gore' into 'graphic-media' during the transition period
// can remove this in a few months
// -prf
translateOldLabels(subject)
return moderatePost(subject, opts) return moderatePost(subject, opts)
} }
function translateOldLabels(subject: Parameters<ModeratePost>[0]) {
if (subject.labels) {
for (const label of subject.labels) {
if (
label.val === 'gore' &&
(!label.src || label.src === BSKY_LABELER_DID)
) {
label.val = 'graphic-media'
}
}
}
}