Merge pull request #599 from Xyphyn/moderation-impr

feat: add view votes modal to comments/posts, close #243
This commit is contained in:
Xylight authored and GitHub committed 2025-06-26 01:56:01 +00:00
1 parent 6191fc7880
commit cd123d56cd
6 files changed
+193 -32

No files matched your search

@@ -27,6 +27,10 @@ interface Modals {
user: Person | undefined
community: Community | undefined
}
votes: {
open: boolean
item: PostView | CommentView | undefined
}
}
export const modals = writable<Modals>({
@@ -45,6 +49,10 @@ export const modals = writable<Modals>({
user: undefined,
community: undefined,
},
votes: {
open: false,
item: undefined,
},
})
export function report(item: PostView | CommentView | PrivateMessageView) {
@@ -87,6 +95,16 @@ export async function feature(featured: boolean, item: Comment, jwt: string) {
})
}
export async function viewVotes(item: PostView | CommentView) {
modals.update(m => ({
...m,
votes: {
open: true,
item: item,
},
}))
}
export const amMod = (me: MyUserInfo, community: Community) =>
me.moderates.map(c => c.community.id).includes(community.id) ||
(community.local && isAdmin(me))