feat: add comment distinguish option

This commit is contained in:
Xylight committed 2024-07-20 11:49:05 -07:00
1 parent 5ea1f2e0cf
commit 0a6310380f
3 files changed
+42 -7

No files matched your search

@@ -1,5 +1,6 @@
import { client } from '$lib/lemmy'
import type { SubmissionView } from '$lib/lemmy/contentview.js'
import type { Community, MyUserInfo, Person } from 'lemmy-js-client'
import type { Comment, Community, MyUserInfo, Person } from 'lemmy-js-client'
import { get, writable } from 'svelte/store'
interface Modals {
@@ -71,6 +72,13 @@ export function ban(banned: boolean, item: Person, community?: Community) {
}))
}
export async function feature(featured: boolean, item: Comment, jwt: string) {
return await client({ auth: jwt }).distinguishComment({
comment_id: item.id,
distinguished: featured,
})
}
export const amMod = (me: MyUserInfo, community: Community) =>
me.moderates.map((c) => c.community.id).includes(community.id) ||
(community.local && isAdmin(me))