Ensure profile labels can be appealed separately from account labels (#5154)
This commit is contained in:
parent
4d97a2aa16
commit
76f493c279
4 changed files with 45 additions and 22 deletions
|
@ -1,6 +1,8 @@
|
|||
import React from 'react'
|
||||
import {
|
||||
AppBskyLabelerDefs,
|
||||
BskyAgent,
|
||||
ComAtprotoLabelDefs,
|
||||
InterpretedLabelValueDefinition,
|
||||
LABELS,
|
||||
ModerationCause,
|
||||
|
@ -82,3 +84,34 @@ export function isLabelerSubscribed(
|
|||
}
|
||||
return modOpts.prefs.labelers.find(l => l.did === labeler)
|
||||
}
|
||||
|
||||
export type Subject =
|
||||
| {
|
||||
uri: string
|
||||
cid: string
|
||||
}
|
||||
| {
|
||||
did: string
|
||||
}
|
||||
|
||||
export function useLabelSubject({label}: {label: ComAtprotoLabelDefs.Label}): {
|
||||
subject: Subject
|
||||
} {
|
||||
return React.useMemo(() => {
|
||||
const {cid, uri} = label
|
||||
if (cid) {
|
||||
return {
|
||||
subject: {
|
||||
uri,
|
||||
cid,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
subject: {
|
||||
did: uri,
|
||||
},
|
||||
}
|
||||
}
|
||||
}, [label])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue