Fix RQ error, return null for query
This commit is contained in:
@@ -49,7 +49,7 @@ export async function getThreadgateRecord({
|
|||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: BskyAgent
|
||||||
postUri: string
|
postUri: string
|
||||||
}): Promise<AppBskyFeedThreadgate.Record | undefined> {
|
}): Promise<AppBskyFeedThreadgate.Record | null> {
|
||||||
const urip = new AtUri(postUri)
|
const urip = new AtUri(postUri)
|
||||||
|
|
||||||
if (!urip.host.startsWith('did:')) {
|
if (!urip.host.startsWith('did:')) {
|
||||||
@@ -71,11 +71,11 @@ export async function getThreadgateRecord({
|
|||||||
if (data.value && AppBskyFeedThreadgate.isRecord(data.value)) {
|
if (data.value && AppBskyFeedThreadgate.isRecord(data.value)) {
|
||||||
return data.value
|
return data.value
|
||||||
} else {
|
} else {
|
||||||
return undefined
|
return null
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e.message.includes(`Could not locate record:`)) {
|
if (e.message.includes(`Could not locate record:`)) {
|
||||||
return undefined
|
return null
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Failed to get threadgate record`, {cause: e})
|
throw new Error(`Failed to get threadgate record`, {cause: e})
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ export async function upsertThreadgate(
|
|||||||
postUri: string
|
postUri: string
|
||||||
},
|
},
|
||||||
callback: (
|
callback: (
|
||||||
threadgate: AppBskyFeedThreadgate.Record | undefined,
|
threadgate: AppBskyFeedThreadgate.Record | null,
|
||||||
) => Promise<AppBskyFeedThreadgate.Record | undefined>,
|
) => Promise<AppBskyFeedThreadgate.Record | undefined>,
|
||||||
) {
|
) {
|
||||||
const prev = await getThreadgateRecord({
|
const prev = await getThreadgateRecord({
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ export function PostThread({
|
|||||||
treeView,
|
treeView,
|
||||||
threadModerationCache,
|
threadModerationCache,
|
||||||
hiddenRepliesState !== HiddenRepliesState.Hide,
|
hiddenRepliesState !== HiddenRepliesState.Hide,
|
||||||
threadgateRecord,
|
threadgateRecord || undefined,
|
||||||
)
|
)
|
||||||
}, [
|
}, [
|
||||||
thread,
|
thread,
|
||||||
|
|||||||
Reference in New Issue
Block a user