misc: use submission type
This commit is contained in:
1 parent
6a4d4077b4
commit
f239ddeabf
2 files changed
+7
-15
No files matched your search
@@ -1,23 +1,15 @@
|
|||||||
import type Post from '$lib/components/lemmy/post/Post.svelte'
|
import type { Submission } from '$lib/lemmy/contentview.js'
|
||||||
import type {
|
import type { Community, MyUserInfo, Person } from 'lemmy-js-client'
|
||||||
CommentView,
|
|
||||||
Community,
|
|
||||||
CommunityView,
|
|
||||||
MyUserInfo,
|
|
||||||
Person,
|
|
||||||
PersonView,
|
|
||||||
PostView,
|
|
||||||
} from 'lemmy-js-client'
|
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
|
|
||||||
interface Modals {
|
interface Modals {
|
||||||
reporting: {
|
reporting: {
|
||||||
open: boolean
|
open: boolean
|
||||||
item: PostView | CommentView | undefined
|
item: Submission | undefined
|
||||||
}
|
}
|
||||||
removing: {
|
removing: {
|
||||||
open: boolean
|
open: boolean
|
||||||
item: PostView | CommentView | undefined
|
item: Submission | undefined
|
||||||
purge: boolean
|
purge: boolean
|
||||||
}
|
}
|
||||||
banning: {
|
banning: {
|
||||||
@@ -46,7 +38,7 @@ export let modals = writable<Modals>({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export function report(item: PostView | CommentView) {
|
export function report(item: Submission) {
|
||||||
modals.update((m) => ({
|
modals.update((m) => ({
|
||||||
...m,
|
...m,
|
||||||
reporting: {
|
reporting: {
|
||||||
@@ -56,7 +48,7 @@ export function report(item: PostView | CommentView) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function remove(item: PostView | CommentView, purge: boolean = false) {
|
export function remove(item: Submission, purge: boolean = false) {
|
||||||
modals.update((m) => ({
|
modals.update((m) => ({
|
||||||
...m,
|
...m,
|
||||||
removing: {
|
removing: {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { getClient } from '$lib/lemmy.js'
|
|||||||
import { isComment, isPost } from '$lib/lemmy/item.js'
|
import { isComment, isPost } from '$lib/lemmy/item.js'
|
||||||
import type { CommentView, Person, PostView } from 'lemmy-js-client'
|
import type { CommentView, Person, PostView } from 'lemmy-js-client'
|
||||||
|
|
||||||
type Submission = PostView | CommentView
|
export type Submission = PostView | CommentView
|
||||||
|
|
||||||
export interface ContentView {
|
export interface ContentView {
|
||||||
type: 'post' | 'comment'
|
type: 'post' | 'comment'
|
||||||
|
|||||||
Reference in new issue
Block a user