feat: add moderation tools (#33)
* feat: Add post submission removal * feat: add comment submission removal * feat: add report viewing and resolving * misc: add notification dot * misc: add locked thread badge * feat: add thread locking * feat: add initiating message conversations * feat: add post pinning/unpinning * misc: bump version * fix: tweak lock colors * fix: update post data on pin * fix: return if reason is empty
This commit is contained in:
1 parent
53ef843cde
commit
d3aae647a8
29 files changed
+835
-67
No files matched your search
@@ -26,6 +26,8 @@
|
||||
upvotes={post.counts.upvotes}
|
||||
downvotes={post.counts.downvotes}
|
||||
deleted={post.post.deleted}
|
||||
removed={post.post.removed}
|
||||
locked={post.post.locked}
|
||||
featured={post.post.featured_local || post.post.featured_community}
|
||||
nsfw={post.post.nsfw}
|
||||
saved={post.saved}
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
|
||||
import { report } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { isMod, report } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ModerationMenu from '$lib/components/lemmy/moderation/ModerationMenu.svelte'
|
||||
|
||||
export let post: PostView
|
||||
|
||||
@@ -98,7 +99,11 @@
|
||||
<Icon slot="icon" src={ChatBubbleOvalLeft} mini width={16} height={16} />
|
||||
<FormattedNumber number={post.counts.comments} />
|
||||
</Button>
|
||||
<Menu alignment="bottom-right" class="ml-auto overflow-auto" let:toggleOpen>
|
||||
<div class="ml-auto" />
|
||||
{#if $user && isMod($user, post.community.id)}
|
||||
<ModerationMenu item={post} community={post.community} />
|
||||
{/if}
|
||||
<Menu alignment="bottom-right" class="overflow-auto" let:toggleOpen>
|
||||
<Button
|
||||
slot="button"
|
||||
label="Post actions"
|
||||
@@ -148,13 +153,13 @@
|
||||
{post.saved ? 'Unsave' : 'Save'}
|
||||
</MenuButton>
|
||||
{#if $user && isMutable(post, $user.local_user_view)}
|
||||
<MenuButton on:click={deletePost} color={Color.dangerSecondary}>
|
||||
<MenuButton on:click={deletePost} color="dangerSecondary">
|
||||
<Icon src={Trash} width={16} mini />
|
||||
Delete
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $user?.local_user_view.person.id != post.creator.id}
|
||||
<MenuButton on:click={() => report(post)} color={Color.dangerSecondary}>
|
||||
<MenuButton on:click={() => report(post)} color="dangerSecondary">
|
||||
<Icon src={Flag} width={16} mini />
|
||||
Report
|
||||
</MenuButton>
|
||||
|
||||
@@ -202,7 +202,13 @@
|
||||
bind:files={data.image}
|
||||
/>
|
||||
</div>
|
||||
<Button submit color="primary" loading={data.loading} size="lg">
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
loading={data.loading}
|
||||
size="lg"
|
||||
disabled={data.loading}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</form>
|
||||
@@ -5,7 +5,13 @@
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import type { Community, Person } from 'lemmy-js-client'
|
||||
import { Bookmark, Icon, InformationCircle, Trash } from 'svelte-hero-icons'
|
||||
import {
|
||||
Bookmark,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
LockClosed,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export let community: Community
|
||||
export let user: Person | undefined = undefined
|
||||
@@ -20,13 +26,17 @@
|
||||
export let saved: boolean
|
||||
export let featured: boolean
|
||||
export let deleted: boolean
|
||||
export let removed: boolean = false
|
||||
export let locked: boolean = false
|
||||
</script>
|
||||
|
||||
<span class="flex flex-row gap-2 text-sm items-center">
|
||||
<Avatar url={community.icon} width={24} alt={community.name} />
|
||||
<div class="flex flex-col text-xs">
|
||||
<CommunityLink {community} />
|
||||
<span class="text-slate-600 dark:text-zinc-400 flex flex-row gap-1 flex-wrap">
|
||||
<span
|
||||
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-1 flex-wrap"
|
||||
>
|
||||
{#if user}
|
||||
<UserLink {user} />
|
||||
<span>•</span>
|
||||
@@ -50,6 +60,16 @@
|
||||
<Icon src={Bookmark} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if locked}
|
||||
<Badge class="bg-yellow-400 text-black py-1" label="Locked">
|
||||
<Icon src={LockClosed} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if removed}
|
||||
<Badge class="bg-green-600 text-white py-1" label="Removed">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if deleted}
|
||||
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
|
||||
@@ -6,6 +6,3 @@ export const isMutable = (post: PostView, me: PersonView) =>
|
||||
export const isCommentMutable = (comment: CommentView, me: PersonView) =>
|
||||
(me.person.admin && comment.comment.local) ||
|
||||
me.person.id == comment.creator.id
|
||||
|
||||
export const isComment = (item: CommentView | PostView): item is CommentView =>
|
||||
'comment' in item
|
||||
Reference in new issue
Block a user