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:
Xylight authored and GitHub committed 2023-07-27 15:53:31 -07:00
1 parent 53ef843cde
commit d3aae647a8
29 files changed
+835 -67

No files matched your search

@@ -1,4 +1,4 @@
import type { CommentView, PostView } from 'lemmy-js-client'
import type { CommentView, MyUserInfo, PostView } from 'lemmy-js-client'
import { writable } from 'svelte/store'
interface Modals {
@@ -6,6 +6,10 @@ interface Modals {
open: boolean
item: PostView | CommentView | undefined
}
removing: {
open: boolean
item: PostView | CommentView | undefined
}
}
export let modals = writable<Modals>({
@@ -13,6 +17,10 @@ export let modals = writable<Modals>({
open: false,
item: undefined,
},
removing: {
open: false,
item: undefined,
},
})
export function report(item: PostView | CommentView) {
@@ -24,3 +32,20 @@ export function report(item: PostView | CommentView) {
},
}))
}
export function remove(item: PostView | CommentView) {
modals.update((m) => ({
...m,
removing: {
open: true,
item: item,
},
}))
}
export const isMod = (me: MyUserInfo, community: number) =>
me.moderates.map((c) => c.community.id).includes(community)
export const isModOfAny = (me?: MyUserInfo) => me && me.moderates.length > 0
export const isAdmin = (me: MyUserInfo) => me.local_user_view.person.admin