feat: add v0.19.0 support

This commit is contained in:
Xyphyn committed 2023-09-28 17:09:09 -07:00
1 parent b3b8a10e44
commit 119ab53946
62 files changed
+188 -157

No files matched your search

@@ -22,7 +22,6 @@
search={async (q) => {
const results = await getClient().search({
q: q || ' ',
auth: jwt,
type_: 'Communities',
limit: 20,
listing_type: listing_type,
@@ -41,7 +41,6 @@
try {
await getClient().editComment({
auth: $profile.jwt,
comment_id: node.comment_view.comment.id,
content: newComment,
})
@@ -31,7 +31,6 @@
try {
const response = await getClient().createComment({
auth: $profile.jwt,
content: value,
post_id: postId,
parent_id: parentId,
@@ -35,7 +35,6 @@
await getClient()
.likeComment({
score: upvoted ? 0 : 1,
auth: $profile.jwt,
comment_id: commentId,
})
.catch((_) => undefined)
@@ -59,7 +58,6 @@
await getClient()
.likeComment({
score: upvoted ? 0 : -1,
auth: $profile.jwt,
comment_id: commentId,
})
.catch((_) => undefined)
@@ -43,7 +43,6 @@
parent.loading = true
const newComments = await getClient($page.params.instance).getComments({
auth: $profile?.jwt,
max_depth: 5,
parent_id: parent.comment_view.comment.id,
type_: 'All',
@@ -41,7 +41,6 @@
try {
await getClient().followCommunity({
auth: $profile.jwt,
community_id: community_view.community.id,
follow: !subscribed,
})
@@ -61,7 +60,6 @@
try {
await getClient().blockCommunity({
auth: $profile.jwt,
community_id: community_view.community.id,
block: !blocked,
})
@@ -49,7 +49,6 @@
const res = edit
? await getClient().editCommunity({
auth: $profile.jwt,
title: formData.displayName,
description: formData.sidebar,
nsfw: formData.nsfw,
@@ -59,7 +58,6 @@
community_id: edit,
})
: await getClient().createCommunity({
auth: $profile.jwt,
name: formData.name,
title: formData.displayName,
description: formData.sidebar,
@@ -20,7 +20,6 @@
try {
await getClient().createPrivateMessage({
auth: $profile.jwt,
content: message,
recipient_id: user.id,
})
@@ -62,7 +62,6 @@
if (community) {
await getClient().banFromCommunity({
auth: $profile.jwt,
ban: !banned,
community_id: community.id,
person_id: item.id,
@@ -72,7 +71,6 @@
})
} else {
await getClient().banPerson({
auth: $profile.jwt,
ban: !banned,
person_id: item.id,
reason: reason || undefined,
@@ -29,7 +29,6 @@
try {
await getClient().lockPost({
auth: $profile.jwt,
locked: lock,
post_id: item.post.id,
})
@@ -60,7 +59,6 @@
try {
await getClient().featurePost({
feature_type: toInstance ? 'Local' : 'Community',
auth: $profile.jwt,
featured: pinned,
post_id: item.post.id,
})
@@ -57,13 +57,11 @@
if (purge) {
if (isCommentView(item)) {
await getClient(undefined, fetch).purgeComment({
auth: $profile.jwt,
comment_id: item.comment.id,
reason: reason,
})
} else {
await getClient(undefined, fetch).purgePost({
auth: $profile.jwt,
post_id: item.post.id,
reason: reason,
})
@@ -91,7 +89,6 @@
if (privateMessage) {
await getClient()
.createPrivateMessage({
auth: $profile.jwt,
content: replyReason,
recipient_id: isCommentView(item)
? item.comment.creator_id
@@ -106,7 +103,6 @@
} else {
await getClient()
.createComment({
auth: $profile.jwt,
content: replyReason,
post_id: item.post.id,
parent_id: isCommentView(item) ? item.comment.id : undefined,
@@ -122,7 +118,6 @@
if (isCommentView(item)) {
await getClient().removeComment({
auth: $profile.jwt,
comment_id: item.comment.id,
removed: !removed,
reason: reason || undefined,
@@ -130,7 +125,6 @@
item.comment.removed = !removed
} else if (isPostView(item)) {
await getClient().removePost({
auth: $profile.jwt,
post_id: item.post.id,
removed: !removed,
reason: reason || undefined,
@@ -27,13 +27,11 @@
try {
if (isComment(item)) {
await getClient().createCommentReport({
auth: $profile.jwt,
comment_id: item.comment.id,
reason: reason,
})
} else if (isPost(item)) {
await getClient().createPostReport({
auth: $profile.jwt,
post_id: item.post.id,
reason: reason,
})
@@ -78,7 +78,7 @@ export const amMod = (me: MyUserInfo, community: Community) =>
export const amModOfAny = (me?: MyUserInfo) =>
me && (me.moderates.length > 0 || isAdmin(me))
export const isAdmin = (me: MyUserInfo) => me.local_user_view.person.admin
export const isAdmin = (me: MyUserInfo) => me.local_user_view.local_user.admin
export const removalTemplate = (
input: string,
@@ -63,7 +63,6 @@
communitySearch = passedCommunity.name
} else {
const list = await getClient().listCommunities({
auth: $profile?.jwt,
type_: 'All',
sort: 'Active',
limit: 40,
@@ -107,7 +106,6 @@
}
const post = await getClient().editPost({
auth: $profile.jwt,
name: data.title,
body: data.body,
url: data.url || undefined,
@@ -121,10 +119,11 @@
dispatcher('submit', post.post_view)
} else {
let image = data.image ? await uploadImage(data.image[0], $profile.instance, $profile.jwt) : undefined
let image = data.image
? await uploadImage(data.image[0], $profile.instance, $profile.jwt)
: undefined
data.url = image || data.url || undefined
const post = await getClient().createPost({
auth: $profile.jwt,
community_id: data.community!,
name: data.title,
body: data.body,
+2 -5
View File
@@ -1,9 +1,6 @@
import { getInstance } from '$lib/lemmy.js'
import type { CommentView, PersonView, Post, PostView } from 'lemmy-js-client'
export const isMutable = (post: PostView, me: PersonView) =>
(me.person.admin && post.post.local) || me.person.id == post.creator.id
export const isCommentMutable = (comment: CommentView, me: PersonView) =>
me.person.id == comment.creator.id
@@ -13,8 +10,8 @@ export const bestImageURL = (
width: number = 1024
) => {
if (width > 1024) {
if (post.url) return `${post.url}?format=webp`
else if (post.thumbnail_url) return `${post.thumbnail_url}?format=webp`
if (post.url) return `${post.url}?format=webp`
else if (post.thumbnail_url) return `${post.thumbnail_url}?format=webp`
}
if (compact && post.thumbnail_url)
+1 -1
View File
@@ -113,7 +113,7 @@
<Button
href="/admin"
aria-label="Admin"
class="max-md:w-9 max-md:h-8 max-md:!p-0 relative"
class="max-md:w-9 max-md:h-8 max-md:!p-0 "
>
<Icon src={CommandLine} mini size="16" slot="prefix" />
<span class="hidden md:inline">Admin</span>