From 60dfbabc608ca6c365d7480ca1644802d489d990 Mon Sep 17 00:00:00 2001 From: Xylight Date: Sun, 11 Feb 2024 14:46:50 -0800 Subject: [PATCH] feat: make post communtiy subscribe buttons always visible --- src/lib/components/lemmy/post/Post.svelte | 6 +++++ src/lib/components/lemmy/post/PostLink.svelte | 27 ++++++++++++------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/lib/components/lemmy/post/Post.svelte b/src/lib/components/lemmy/post/Post.svelte index 0db54653..46e7b80a 100644 --- a/src/lib/components/lemmy/post/Post.svelte +++ b/src/lib/components/lemmy/post/Post.svelte @@ -20,6 +20,7 @@ import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte' import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte' import PostBody from './PostBody.svelte' + import { profile } from '$lib/auth' export let post: PostView export let actions: boolean = true @@ -61,6 +62,11 @@ featured={post.post.featured_local || post.post.featured_community} nsfw={post.post.nsfw} saved={post.saved} + subscribed={$profile?.user?.follows + .map((c) => c.community.id) + .includes(post.community.id) + ? 'Subscribed' + : 'NotSubscribed'} > diff --git a/src/lib/components/lemmy/post/PostLink.svelte b/src/lib/components/lemmy/post/PostLink.svelte index b01f52fb..4bd702e7 100644 --- a/src/lib/components/lemmy/post/PostLink.svelte +++ b/src/lib/components/lemmy/post/PostLink.svelte @@ -14,7 +14,7 @@ {#if embed_title && !compact} - +
{#if richURL} {#if embed_description} -

- {embed_description.slice(0, 300)} +

+ {embed_description.slice(0, 300)}{embed_description.length > 300 + ? '...' + : ''}

{/if}
{#if thumbnail_url} - + {/if} {/if} + +