Add Leave chat button to settings for chat owners (#10764)

Co-authored-by: Samuel Newman <mozzius@protonmail.com>
This commit is contained in:
DS Boyce
2026-06-08 04:57:08 -07:00
committed by GitHub
parent e60e31733a
commit 6997d220a0
3 changed files with 96 additions and 36 deletions
@@ -14,15 +14,21 @@ export function useLockConvo(
onSuccess,
onError,
}: {
onSuccess?: (data: ChatBskyConvoLockConvo.OutputSchema) => void
onError?: (error: Error, variables: {lock: boolean}) => void
onSuccess?: (
data: ChatBskyConvoLockConvo.OutputSchema,
variables: {lock: boolean; silent?: boolean},
) => void
onError?: (
error: Error,
variables: {lock: boolean; silent?: boolean},
) => void
},
) {
const queryClient = useQueryClient()
const agent = useAgent()
return useMutation({
mutationFn: async ({lock}: {lock: boolean}) => {
mutationFn: async ({lock}: {lock: boolean; silent?: boolean}) => {
if (!convoId) throw new Error('No convoId provided')
if (lock) {
const {data} = await agent.chat.bsky.convo.lockConvo(
@@ -51,8 +57,8 @@ export function useLockConvo(
}
})
},
onSuccess: data => {
onSuccess?.(data)
onSuccess: (data, variables) => {
onSuccess?.(data, variables)
},
onError: (e, variables, context) => {
if (convoId && context) {