misc: remove avatar for NSFW community links
This commit is contained in:
3 files changed
+38
-53
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
|
import { communityLink } from '$lib/lemmy/generic'
|
||||||
import { settings } from '$lib/settings.svelte.js'
|
import { settings } from '$lib/settings.svelte.js'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import type { Community } from 'lemmy-js-client'
|
import type { Community } from 'lemmy-js-client'
|
||||||
@@ -37,10 +38,10 @@
|
|||||||
<a
|
<a
|
||||||
{...rest}
|
{...rest}
|
||||||
class="items-center flex flex-row gap-2 hover:underline max-w-full min-w-0 {clazz}"
|
class="items-center flex flex-row gap-2 hover:underline max-w-full min-w-0 {clazz}"
|
||||||
href="/c/{community.name}@{new URL(community.actor_id).hostname}"
|
href={communityLink(community)}
|
||||||
data-sveltekit-preload-data="tap"
|
data-sveltekit-preload-data="tap"
|
||||||
>
|
>
|
||||||
{#if avatar}
|
{#if avatar && !badges.nsfw}
|
||||||
<Avatar
|
<Avatar
|
||||||
url={community.icon ??
|
url={community.icon ??
|
||||||
`https://api.dicebear.com/6.x/initials/svg?seed=${community.name}`}
|
`https://api.dicebear.com/6.x/initials/svg?seed=${community.name}`}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||||
import { searchParam } from '$lib/util.svelte.js'
|
import { searchParam } from '$lib/util.svelte.js'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import { Button, Modal, Select } from 'mono-svelte'
|
import { Button, Modal, Select, Option } from 'mono-svelte'
|
||||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||||
import { communityLink } from '$lib/lemmy/generic.js'
|
import { communityLink } from '$lib/lemmy/generic.js'
|
||||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||||
@@ -35,7 +35,6 @@
|
|||||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||||
import { publishedToDate } from '$lib/components/util/date.js'
|
import { publishedToDate } from '$lib/components/util/date.js'
|
||||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
|
||||||
import type { PageData } from './$types'
|
import type { PageData } from './$types'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
|
||||||
@@ -44,9 +43,7 @@
|
|||||||
inline?: boolean
|
inline?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
let { data: pageData, inline = false }: Props = $props()
|
let { data, inline = false }: Props = $props()
|
||||||
|
|
||||||
let data = $state(pageData)
|
|
||||||
|
|
||||||
let blocking = false
|
let blocking = false
|
||||||
let sortForm = $state<HTMLFormElement>()
|
let sortForm = $state<HTMLFormElement>()
|
||||||
@@ -88,8 +85,6 @@
|
|||||||
blocking = false
|
blocking = false
|
||||||
}
|
}
|
||||||
|
|
||||||
let messaging = $state(false)
|
|
||||||
|
|
||||||
let purgingUser = $state(false)
|
let purgingUser = $state(false)
|
||||||
let purgeEnabled = $state(false)
|
let purgeEnabled = $state(false)
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
@@ -107,7 +102,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await client().purgePerson({
|
await client().purgePerson({
|
||||||
person_id: data.person_view.person.id,
|
person_id: data.person_view.value.person.id,
|
||||||
})
|
})
|
||||||
removeToast(purgeToast)
|
removeToast(purgeToast)
|
||||||
toast({ content: $t('toast.purgeUser'), type: 'success' })
|
toast({ content: $t('toast.purgeUser'), type: 'success' })
|
||||||
@@ -118,7 +113,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>{data.person_view.person.name}</title>
|
<title>{data.person_view.value.person.name}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
{#if purgingUser}
|
{#if purgingUser}
|
||||||
@@ -128,7 +123,7 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
<p>
|
<p>
|
||||||
Purging user <span class="font-bold">
|
Purging user <span class="font-bold">
|
||||||
{data.person_view.person.name}
|
{data.person_view.value.person.name}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@@ -156,24 +151,24 @@
|
|||||||
<Header pageHeader>
|
<Header pageHeader>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<EntityHeader
|
<EntityHeader
|
||||||
avatar={data.person_view.person.avatar}
|
avatar={data.person_view.value.person.avatar}
|
||||||
name={data.person_view.person.display_name ||
|
name={data.person_view.value.person.display_name ||
|
||||||
data.person_view.person.name}
|
data.person_view.value.person.name}
|
||||||
banner={data.person_view.person.banner}
|
banner={data.person_view.value.person.banner}
|
||||||
bio={data.person_view.person.bio}
|
bio={data.person_view.value.person.bio}
|
||||||
stats={[
|
stats={[
|
||||||
{
|
{
|
||||||
name: $t('content.posts'),
|
name: $t('content.posts'),
|
||||||
value: data.person_view.counts.post_count.toString(),
|
value: data.person_view.value.counts.post_count.toString(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: $t('content.comments'),
|
name: $t('content.comments'),
|
||||||
value: data.person_view.counts.comment_count.toString(),
|
value: data.person_view.value.counts.comment_count.toString(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: $t('stats.joined'),
|
name: $t('stats.joined'),
|
||||||
value: formatRelativeDate(
|
value: formatRelativeDate(
|
||||||
publishedToDate(data.person_view.person.published),
|
publishedToDate(data.person_view.value.person.published),
|
||||||
{ style: 'short' },
|
{ style: 'short' },
|
||||||
).toString(),
|
).toString(),
|
||||||
format: false,
|
format: false,
|
||||||
@@ -185,13 +180,13 @@
|
|||||||
@
|
@
|
||||||
<UserLink
|
<UserLink
|
||||||
showInstance
|
showInstance
|
||||||
user={data.person_view.person}
|
user={data.person_view.value.person}
|
||||||
displayName={false}
|
displayName={false}
|
||||||
class="font-normal"
|
class="font-normal"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
{#if (data.moderates ?? []).length > 0}
|
{#if (data.moderates.value ?? []).length > 0}
|
||||||
<Expandable class="">
|
<Expandable class="">
|
||||||
{#snippet title()}
|
{#snippet title()}
|
||||||
{$t('routes.profile.moderates')}
|
{$t('routes.profile.moderates')}
|
||||||
@@ -200,7 +195,7 @@
|
|||||||
/>
|
/>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<ItemList
|
<ItemList
|
||||||
items={data.moderates.map((m) => ({
|
items={data.moderates.value.map((m) => ({
|
||||||
id: m.community.id,
|
id: m.community.id,
|
||||||
name: m.community.title,
|
name: m.community.title,
|
||||||
url: communityLink(m.community),
|
url: communityLink(m.community),
|
||||||
@@ -211,23 +206,23 @@
|
|||||||
</Expandable>
|
</Expandable>
|
||||||
{/if}
|
{/if}
|
||||||
{#snippet actions()}
|
{#snippet actions()}
|
||||||
{#if profile.data?.user && profile.data.jwt && data.person_view.person.id != profile.data.user.local_user_view.person.id}
|
{#if profile.data?.user && profile.data.jwt && data.person_view.value.person.id != profile.data.user.local_user_view.person.id}
|
||||||
<div class="flex items-center gap-2 w-full">
|
<div class="flex items-center gap-2 w-full">
|
||||||
<Button
|
<Button
|
||||||
size="square-md"
|
size="square-md"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
href="/inbox/messages/{data.person_view.person.id}"
|
href="/inbox/messages/{data.person_view.value.person.id}"
|
||||||
title="Message"
|
title="Message"
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon solid size="16" src={Envelope} />
|
<Icon solid size="16" src={Envelope} />
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Button>
|
</Button>
|
||||||
{#if data.person_view.person.matrix_user_id}
|
{#if data.person_view.value.person.matrix_user_id}
|
||||||
<Button
|
<Button
|
||||||
size="square-md"
|
size="square-md"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
href="https://matrix.to/#/{data.person_view.person
|
href="https://matrix.to/#/{data.person_view.value.person
|
||||||
.matrix_user_id}"
|
.matrix_user_id}"
|
||||||
title="Matrix User"
|
title="Matrix User"
|
||||||
>
|
>
|
||||||
@@ -247,14 +242,14 @@
|
|||||||
color="danger-subtle"
|
color="danger-subtle"
|
||||||
onclick={() =>
|
onclick={() =>
|
||||||
ban(
|
ban(
|
||||||
data.person_view.person.banned,
|
data.person_view.value.person.banned,
|
||||||
data.person_view.person,
|
data.person_view.value.person,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon mini size="16" src={ShieldExclamation} />
|
<Icon mini size="16" src={ShieldExclamation} />
|
||||||
{/snippet}
|
{/snippet}
|
||||||
{data.person_view.person.banned ? 'Unban' : 'Ban'}
|
{data.person_view.value.person.banned ? 'Unban' : 'Ban'}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton
|
<MenuButton
|
||||||
color="danger-subtle"
|
color="danger-subtle"
|
||||||
@@ -277,12 +272,15 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
<MenuButton
|
<MenuButton
|
||||||
color="danger-subtle"
|
color="danger-subtle"
|
||||||
onclick={() => blockUser(data.person_view.person.id)}
|
onclick={() => blockUser(data.person_view.value.person.id)}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon mini size="16" src={NoSymbol} />
|
<Icon mini size="16" src={NoSymbol} />
|
||||||
{/snippet}
|
{/snippet}
|
||||||
{isBlocked(profile.data.user, data.person_view.person.id)
|
{isBlocked(
|
||||||
|
profile.data.user,
|
||||||
|
data.person_view.value.person.id,
|
||||||
|
)
|
||||||
? 'Unblock'
|
? 'Unblock'
|
||||||
: 'Block'}
|
: 'Block'}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
@@ -313,7 +311,6 @@
|
|||||||
{$t('filter.type')}
|
{$t('filter.type')}
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<Option value="all">{$t('content.all')}</Option>
|
|
||||||
<Option value="posts">{$t('content.posts')}</Option>
|
<Option value="posts">{$t('content.posts')}</Option>
|
||||||
<Option value="comments">{$t('content.comments')}</Option>
|
<Option value="comments">{$t('content.comments')}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
@@ -331,6 +328,7 @@
|
|||||||
<Option value="New">{$t('filter.sort.new')}</Option>
|
<Option value="New">{$t('filter.sort.new')}</Option>
|
||||||
<Option value="TopAll">{$t('filter.sort.top.label')}</Option>
|
<Option value="TopAll">{$t('filter.sort.top.label')}</Option>
|
||||||
<Option value="Old">{$t('filter.sort.old')}</Option>
|
<Option value="Old">{$t('filter.sort.old')}</Option>
|
||||||
|
<Option value="Controversial">{$t('filter.sort.controversial')}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</form>
|
</form>
|
||||||
{#if data.items.value.length == 0}
|
{#if data.items.value.length == 0}
|
||||||
@@ -344,9 +342,9 @@
|
|||||||
class="!divide-y divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
class="!divide-y divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
||||||
>
|
>
|
||||||
{#each data.items.value as item}
|
{#each data.items.value as item}
|
||||||
{#if isCommentView(item) && (data.filters.value.type == 'all' || data.filters.value.type == 'comments')}
|
{#if isCommentView(item)}
|
||||||
<CommentItem comment={item} />
|
<CommentItem comment={item} />
|
||||||
{:else if !isCommentView(item) && (data.filters.value.type == 'all' || data.filters.value.type == 'posts')}
|
{:else if !isCommentView(item)}
|
||||||
<Post post={item} />
|
<Post post={item} />
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import type { SortType } from 'lemmy-js-client'
|
|||||||
|
|
||||||
export async function load({ params, url, fetch }) {
|
export async function load({ params, url, fetch }) {
|
||||||
const page = Number(url.searchParams.get('page')) || 1
|
const page = Number(url.searchParams.get('page')) || 1
|
||||||
const type: 'comments' | 'posts' | 'all' =
|
const type: 'comments' | 'posts' =
|
||||||
(url.searchParams.get('type') as 'comments' | 'posts' | 'all') || 'all'
|
(url.searchParams.get('type') as 'comments' | 'posts') || 'posts'
|
||||||
const sort: SortType = (url.searchParams.get('sort') as SortType) || 'New'
|
const sort: SortType = (url.searchParams.get('sort') as SortType) || 'New'
|
||||||
|
|
||||||
const user = await getClient(undefined, fetch).getPersonDetails({
|
const user = await getClient(undefined, fetch).getPersonDetails({
|
||||||
@@ -18,28 +18,14 @@ export async function load({ params, url, fetch }) {
|
|||||||
|
|
||||||
const items = [...user.posts, ...user.comments]
|
const items = [...user.posts, ...user.comments]
|
||||||
|
|
||||||
if (sort == 'TopAll') {
|
|
||||||
items.sort(
|
|
||||||
(a, b) =>
|
|
||||||
b.counts.upvotes -
|
|
||||||
b.counts.downvotes -
|
|
||||||
(a.counts.upvotes - a.counts.downvotes),
|
|
||||||
)
|
|
||||||
} else if (sort == 'New') {
|
|
||||||
items.sort(
|
|
||||||
(a, b) =>
|
|
||||||
Date.parse(getItemPublished(b)) - Date.parse(getItemPublished(a)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filters: new ReactiveState({
|
filters: new ReactiveState({
|
||||||
type: type,
|
type: type,
|
||||||
page: page,
|
page: page,
|
||||||
sort: sort,
|
sort: sort,
|
||||||
}),
|
}),
|
||||||
person_view: user.person_view,
|
person_view: new ReactiveState(user.person_view),
|
||||||
moderates: user.moderates,
|
moderates: new ReactiveState(user.moderates),
|
||||||
items: new ReactiveState(items),
|
items: new ReactiveState(items),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user