about summary refs log tree commit diff
path: root/bskyembed/src/components/post.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-04-13 03:18:18 -0700
committerGitHub <noreply@github.com>2024-04-13 11:18:18 +0100
commit826f6b043ca73f3cc459fbac62ae6de5f82e362b (patch)
tree296cd847fa76d2d0691ffdeaa59b6731714cef47 /bskyembed/src/components/post.tsx
parentf5bb348bf51df6f6d35eb23cdf771c184d77fec4 (diff)
downloadvoidsky-826f6b043ca73f3cc459fbac62ae6de5f82e362b.tar.zst
Moderate content in embeds (#3525)
* move info to its own file

* Revert "move info to its own file"

This reverts commit 1d45a2f4034f50cbe9cb25070f954042cdf9127a.

* better way

* all cases

* pass labelInfo to ImageEmbed

* blur avatars

* add back as string

* one more as string

* external embed

* add back as string again
Diffstat (limited to 'bskyembed/src/components/post.tsx')
-rw-r--r--bskyembed/src/components/post.tsx17
1 files changed, 12 insertions, 5 deletions
diff --git a/bskyembed/src/components/post.tsx b/bskyembed/src/components/post.tsx
index dcbf3e336..d0eaf228a 100644
--- a/bskyembed/src/components/post.tsx
+++ b/bskyembed/src/components/post.tsx
@@ -5,6 +5,7 @@ import replyIcon from '../../assets/bubble_filled_stroke2_corner2_rounded.svg'
 import likeIcon from '../../assets/heart2_filled_stroke2_corner0_rounded.svg'
 import logo from '../../assets/logo.svg'
 import repostIcon from '../../assets/repost_stroke2_corner2_rounded.svg'
+import {CONTENT_LABELS} from '../labels'
 import {getRkey, niceDate} from '../utils'
 import {Container} from './container'
 import {Embed} from './embed'
@@ -17,6 +18,10 @@ interface Props {
 export function Post({thread}: Props) {
   const post = thread.post
 
+  const isAuthorLabeled = post.author.labels?.some(label =>
+    CONTENT_LABELS.includes(label.val),
+  )
+
   let record: AppBskyFeedPost.Record | null = null
   if (AppBskyFeedPost.isRecord(post.record)) {
     record = post.record
@@ -28,10 +33,12 @@ export function Post({thread}: Props) {
       <div className="flex-1 flex-col flex gap-2" lang={record?.langs?.[0]}>
         <div className="flex gap-2.5 items-center">
           <Link href={`/profile/${post.author.did}`} className="rounded-full">
-            <img
-              src={post.author.avatar}
-              className="w-10 h-10 rounded-full bg-neutral-300 shrink-0"
-            />
+            <div className="w-10 h-10 overflow-hidden rounded-full bg-neutral-300 shrink-0">
+              <img
+                src={post.author.avatar}
+                style={isAuthorLabeled ? {filter: 'blur(2.5px)'} : undefined}
+              />
+            </div>
           </Link>
           <div className="flex-1">
             <Link
@@ -52,7 +59,7 @@ export function Post({thread}: Props) {
           </Link>
         </div>
         <PostContent record={record} />
-        <Embed content={post.embed} />
+        <Embed content={post.embed} labels={post.labels} />
         <time
           datetime={new Date(post.indexedAt).toISOString()}
           className="text-textLight mt-1 text-sm">