+21
-3
src/components/notifications/notification-item.tsx
+21
-3
src/components/notifications/notification-item.tsx
···
2
2
3
3
import type {
4
4
AppBskyEmbedImages,
5
+
AppBskyFeedDefs,
5
6
AppBskyFeedPost,
6
7
AppBskyNotificationListNotifications,
7
8
} from '@atcute/client/lexicons';
8
9
import { useQueryClient } from '@mary/solid-query';
9
10
11
+
import { getModerationUI } from '~/api/moderation';
12
+
import { ContextContentMedia } from '~/api/moderation/constants';
13
+
import { moderatePost } from '~/api/moderation/entities/post';
10
14
import { moderateProfile } from '~/api/moderation/entities/profile';
11
15
import { precacheProfile } from '~/api/queries-cache/profile-precache';
12
16
import type {
···
244
248
{
245
249
/* @once */ media &&
246
250
(media.$type === 'app.bsky.embed.images#view' ? (
247
-
<ImageAccessory images={/* @once */ media.images} />
251
+
<ImageAccessory post={post} images={/* @once */ media.images} />
248
252
) : gif ? (
249
253
<GifAccessory snippet={gif} />
250
254
) : null)
···
254
258
}
255
259
};
256
260
257
-
const ImageAccessory = ({ images }: { images: AppBskyEmbedImages.ViewImage[] }) => {
261
+
const ImageAccessory = ({
262
+
post,
263
+
images,
264
+
}: {
265
+
post: AppBskyFeedDefs.PostView;
266
+
images: AppBskyEmbedImages.ViewImage[];
267
+
}) => {
268
+
const moderationOptions = inject(ModerationService);
269
+
270
+
const moderation = createMemo(() => moderatePost(post, moderationOptions()));
271
+
const shouldBlurMedia = createMemo(() => getModerationUI(moderation(), ContextContentMedia).b.length !== 0);
272
+
258
273
const nodes = images.map((img) => {
259
274
return (
260
275
<div class="shrink-0 overflow-hidden rounded bg-background">
261
-
<img src={/* @once */ img.fullsize} class="h-32 w-32 object-cover opacity-75" />
276
+
<img
277
+
src={/* @once */ img.fullsize}
278
+
class={`h-32 w-32 object-cover opacity-75` + (shouldBlurMedia() ? ` scale-125 blur` : ``)}
279
+
/>
262
280
</div>
263
281
);
264
282
});