feat: add media bias fact check support
This commit is contained in:
1 parent
b97ebffc08
commit
d2748faacf
9 files changed
+249
-14
No files matched your search
@@ -154,7 +154,7 @@
|
||||
<PostBody body={post.post.body} {view} style="grid-area: body" />
|
||||
{/if}
|
||||
{#if actions}
|
||||
<PostActions on:hide bind:post style="grid-area: actions;" />
|
||||
<PostActions on:hide bind:post {type} style="grid-area: actions;" />
|
||||
{:else if view == 'compact'}
|
||||
<div class="flex flex-row items-center gap-2 text-sm">
|
||||
<Badge>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
BugAnt,
|
||||
ChatBubbleOvalLeft,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
CheckBadge,
|
||||
EllipsisHorizontal,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
@@ -19,6 +20,7 @@
|
||||
Language,
|
||||
Newspaper,
|
||||
PencilSquare,
|
||||
Scale,
|
||||
ServerStack,
|
||||
Share,
|
||||
Trash,
|
||||
@@ -57,18 +59,19 @@
|
||||
import { t } from '$lib/translations'
|
||||
import { text } from '$lib/components/translate/translation'
|
||||
import Translation from '$lib/components/translate/Translation.svelte'
|
||||
import { hidePost, postLink } from './helpers'
|
||||
import { hidePost, postLink, type MediaType } from './helpers'
|
||||
import { feature } from '$lib/version'
|
||||
import Switch from '$lib/components/input/Switch.svelte'
|
||||
import { instanceToURL } from '$lib/util'
|
||||
|
||||
export let post: PostView
|
||||
export let type: MediaType | undefined = undefined
|
||||
export let debug: boolean = false
|
||||
|
||||
const dispatcher = createEventDispatcher<{ edit: PostView; hide: boolean }>()
|
||||
|
||||
let editing = false
|
||||
let saving = false
|
||||
export let debug: boolean = false
|
||||
|
||||
let fediseerOpen = false
|
||||
let fediseerData: Data | null = null
|
||||
@@ -77,6 +80,11 @@
|
||||
let translating = false
|
||||
|
||||
let localShare = false
|
||||
|
||||
let mediaBias = false
|
||||
|
||||
const stripSubdomain = (url: string) =>
|
||||
new URL(url).hostname.split('.').slice(-2).join('.')
|
||||
</script>
|
||||
|
||||
{#if fediseerData}
|
||||
@@ -110,7 +118,15 @@
|
||||
{/if}
|
||||
|
||||
{#if translating}
|
||||
<Translation bind:open={translating} />
|
||||
{#await import('$lib/components/translate/Translation.svelte') then { default: Translation }}
|
||||
<Translation bind:open={translating} />
|
||||
{/await}
|
||||
{/if}
|
||||
|
||||
{#if mediaBias && post.post.url}
|
||||
{#await import('$lib/components/mbfc/MBFCModal.svelte') then { default: MbfcModal }}
|
||||
<MbfcModal domain={stripSubdomain(post.post.url)} bind:open={mediaBias} />
|
||||
{/await}
|
||||
{/if}
|
||||
|
||||
<div
|
||||
@@ -179,6 +195,16 @@
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
{#if post.post.url && type == 'embed'}
|
||||
<Button
|
||||
size="square-md"
|
||||
color="ghost"
|
||||
on:click={() => (mediaBias = !mediaBias)}
|
||||
title={$t('post.actions.more.mediaBias')}
|
||||
>
|
||||
<Icon src={CheckBadge} micro size="16" />
|
||||
</Button>
|
||||
{/if}
|
||||
<Menu
|
||||
placement="bottom-end"
|
||||
containerClass="overflow-auto max-h-[400px]"
|
||||
@@ -217,7 +243,7 @@
|
||||
|
||||
fediseerLoading = true
|
||||
const data = await fediseer.getInstanceInfo(
|
||||
new URL(post.community.actor_id).hostname
|
||||
new URL(post.community.actor_id).hostname,
|
||||
)
|
||||
fediseerData = data
|
||||
fediseerOpen = true
|
||||
@@ -266,7 +292,7 @@
|
||||
navigator.clipboard.writeText(
|
||||
localShare
|
||||
? `${instanceToURL(getInstance())}/post/${post.post.id}`
|
||||
: post.post.ap_id
|
||||
: post.post.ap_id,
|
||||
)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
@@ -333,7 +359,7 @@
|
||||
post.post.deleted = await deleteItem(
|
||||
post,
|
||||
!post.post.deleted,
|
||||
$profile.jwt
|
||||
$profile.jwt,
|
||||
)
|
||||
}}
|
||||
color="danger-subtle"
|
||||
@@ -352,7 +378,7 @@
|
||||
const hidden = await hidePost(
|
||||
post.post.id,
|
||||
!post.hidden,
|
||||
$profile?.jwt
|
||||
$profile?.jwt,
|
||||
)
|
||||
post.hidden = hidden
|
||||
if (hidden) {
|
||||
|
||||
@@ -67,17 +67,19 @@
|
||||
<Button
|
||||
href={url}
|
||||
target="_blank"
|
||||
class="text-slate-700 dark:text-zinc-300 inline-flex items-center gap-1 text-xs overflow-hidden w-max max-w-full"
|
||||
class="text-slate-900 dark:text-zinc-300 inline-flex items-center gap-1 text-xs overflow-hidden w-max max-w-full"
|
||||
size="sm"
|
||||
color="ghost"
|
||||
rounding="pill"
|
||||
>
|
||||
<Icon src={LinkIcon} size="14" mini slot="prefix" class="flex-shrink-0" />
|
||||
{#if richURL}
|
||||
<div class="flex max-w-full overflow-hidden">
|
||||
<div class="flex max-w-full overflow-hidden font-medium">
|
||||
{richURL.hostname}
|
||||
{#if richURL.pathname != '/'}
|
||||
<span class="text-slate-500 dark:text-zinc-500 whitespace-nowrap">
|
||||
<span
|
||||
class="text-slate-500 dark:text-zinc-500 whitespace-nowrap font-normal"
|
||||
>
|
||||
{richURL.pathname}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
Reference in new issue
Block a user