feat: add ability to hide deleted or removed posts (#71)
* feat: add ability to hide deleted or removed posts
Add hidePosts.{deleted,removed} settings to control whether or not to
display posts that have been marked as deleted or removed. By default,
these are enabled (ie. hidden) to correspond to Lemmy-UI behavior.
Currently, we only hide these posts for the front page and community
pages.
* feat: show removed posts by default
---------
Co-authored-by: Xyphyn <james@xylight.dev>
This commit is contained in:
1 parent
6ea697e3bc
commit
85468a5059
4 files changed
+33
No files matched your search
@@ -17,6 +17,10 @@ interface Settings {
|
|||||||
sort: SortType
|
sort: SortType
|
||||||
feed: 'All' | 'Subscribed' | 'Local'
|
feed: 'All' | 'Subscribed' | 'Local'
|
||||||
}
|
}
|
||||||
|
hidePosts: {
|
||||||
|
deleted: boolean,
|
||||||
|
removed: boolean,
|
||||||
|
},
|
||||||
fullWidthLayout: boolean
|
fullWidthLayout: boolean
|
||||||
expandSidebar: boolean
|
expandSidebar: boolean
|
||||||
}
|
}
|
||||||
@@ -36,6 +40,10 @@ const defaultSettings: Settings = {
|
|||||||
sort: 'Active',
|
sort: 'Active',
|
||||||
feed: 'Local',
|
feed: 'Local',
|
||||||
},
|
},
|
||||||
|
hidePosts: {
|
||||||
|
deleted: true,
|
||||||
|
removed: false,
|
||||||
|
},
|
||||||
fullWidthLayout: false,
|
fullWidthLayout: false,
|
||||||
expandSidebar: true,
|
expandSidebar: true,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import Sort from '$lib/components/lemmy/Sort.svelte'
|
import Sort from '$lib/components/lemmy/Sort.svelte'
|
||||||
import { searchParam } from '$lib/util.js'
|
import { searchParam } from '$lib/util.js'
|
||||||
|
import { userSettings } from '$lib/settings.js'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
|
|
||||||
@@ -74,6 +75,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#each data.posts.posts as post, index (post.post.id)}
|
{#each data.posts.posts as post, index (post.post.id)}
|
||||||
|
{#if
|
||||||
|
!($userSettings.hidePosts.deleted && post.post.deleted) &&
|
||||||
|
!($userSettings.hidePosts.removed && post.post.removed)
|
||||||
|
}
|
||||||
<div
|
<div
|
||||||
in:fly={{
|
in:fly={{
|
||||||
y: -8,
|
y: -8,
|
||||||
@@ -84,6 +89,7 @@
|
|||||||
>
|
>
|
||||||
<Post {post} />
|
<Post {post} />
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</section>
|
</section>
|
||||||
<Pageination
|
<Pageination
|
||||||
|
|||||||
@@ -66,9 +66,14 @@
|
|||||||
<Sort selected={data.sort} />
|
<Sort selected={data.sort} />
|
||||||
</div>
|
</div>
|
||||||
{#each data.posts.posts as post, index (post.post.id)}
|
{#each data.posts.posts as post, index (post.post.id)}
|
||||||
|
{#if
|
||||||
|
!($userSettings.hidePosts.deleted && post.post.deleted) &&
|
||||||
|
!($userSettings.hidePosts.removed && post.post.removed)
|
||||||
|
}
|
||||||
<div in:fly={{ y: -8, opacity: 0, delay: index < 4 ? index * 100 : 0 }}>
|
<div in:fly={{ y: -8, opacity: 0, delay: index < 4 ? index * 100 : 0 }}>
|
||||||
<Post hideCommunity={true} {post} />
|
<Post hideCommunity={true} {post} />
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
<Pageination
|
<Pageination
|
||||||
page={data.page}
|
page={data.page}
|
||||||
|
|||||||
@@ -64,6 +64,20 @@
|
|||||||
</span>
|
</span>
|
||||||
<Switch bind:enabled={$userSettings.showCompactPosts} />
|
<Switch bind:enabled={$userSettings.showCompactPosts} />
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting>
|
||||||
|
<span slot="title">Hide Posts</span>
|
||||||
|
<span slot="description">Hide certain types of posts.</span>
|
||||||
|
<div class="flex flex-row items-center gap-4">
|
||||||
|
<div class="flex items-center gap-1 font-bold">
|
||||||
|
Deleted Posts
|
||||||
|
<Switch bind:enabled={$userSettings.hidePosts.deleted} />
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-1 font-bold">
|
||||||
|
Removed Posts
|
||||||
|
<Switch bind:enabled={$userSettings.hidePosts.removed} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Setting>
|
||||||
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">Instances</h2>
|
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">Instances</h2>
|
||||||
<Setting>
|
<Setting>
|
||||||
<span slot="title">Show instances</span>
|
<span slot="title">Show instances</span>
|
||||||
|
|||||||
Reference in new issue
Block a user