Hackfix to translate gore labels to graphic-media
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
import {moderatePost} from '@atproto/api'
|
||||
|
||||
// TODO
|
||||
// do we think we'll need this again?
|
||||
// if not we can ditch it!
|
||||
// -prf
|
||||
import {moderatePost, BSKY_LABELER_DID} from '@atproto/api'
|
||||
|
||||
type ModeratePost = typeof moderatePost
|
||||
type Options = Parameters<ModeratePost>[1]
|
||||
@@ -12,5 +7,24 @@ export function moderatePost_wrapped(
|
||||
subject: Parameters<ModeratePost>[0],
|
||||
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)
|
||||
}
|
||||
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user