-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Show post preview even when moderator is blocked by the author #114
Conversation
Your Render PR Server URL is https://ozone-staging-pr-114.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cosh936d3nmc73f3kjb0. |
Your Render PR Server URL is https://ozone-sandbox-pr-114.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cosh93ud3nmc73f3kjgg. |
} else if (Array.isArray(item.post.labels?.['values'])) { | ||
// This handles the case where the item may be built from raw record and in that case, labels value is not an array rather a self label object | ||
const labels = item.post.labels?.['values'] as unknown as Array<{ | ||
val: string | ||
}> | ||
labels.forEach(({ val }) => labelVals.push(val)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than passing a raw record here and deviating in this way from the expected, valid FeedViewPost
type, I wonder if it may be friendlier to instead build the labels
object on the other side and avoid this special case on the consumer side.
Might look something like:
if (data?.thread?.blocked) {
return (
<BaseRecordCard
uri={uri}
renderRecord={(record) => (
<PostAsCard
dense
controls={false}
item={{
post: {
uri: record.uri,
cid: record.cid,
author: record.repo,
record: record.value,
labels: isSelfLabels(record.value['labels'])
? record.value['labels'].values.map(({ val }) => ({
val,
uri: record.uri,
src: record.repo.did,
cts: new Date(0).toISOString(),
}))
: [],
indexedAt: new Date(0).toISOString(),
},
}}
/>
)}
/>
)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that looks cleaner, thanks!
Since
getPostThread
does not return post record data when there's a block relationship between author and the moderator viewer, this PR builds the post data fromgetRecord
so that post preview is displayed properly in the quick action panel.