diff --git a/src/lib/components/lemmy/post/PostForm.svelte b/src/lib/components/lemmy/post/PostForm.svelte index 6210f646..e64260e6 100644 --- a/src/lib/components/lemmy/post/PostForm.svelte +++ b/src/lib/components/lemmy/post/PostForm.svelte @@ -11,6 +11,7 @@ import { getSessionStorage, setSessionStorage } from '$lib/session.js' import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte' import { Button } from 'mono-svelte' + import Avatar from '$lib/components/ui/Avatar.svelte' export let edit = false @@ -19,15 +20,10 @@ */ export let editingPost: Post | undefined = undefined - export let passedCommunity: - | { - id: number - name: string - } - | undefined = undefined + export let passedCommunity: Community | undefined = undefined export let data: { - community: number | null + community: Community | null title: string body: string image: FileList | null @@ -59,7 +55,7 @@ } if (passedCommunity) { - data.community = passedCommunity.id + data.community = passedCommunity communitySearch = passedCommunity.name console.log(communitySearch) } else { @@ -125,7 +121,7 @@ : undefined data.url = image || data.url || undefined const post = await client().createPost({ - community_id: data.community!, + community_id: data.community!.id, name: data.title, body: data.body, url: data.url, @@ -213,25 +209,14 @@ {#if !edit && data} -
-
- - Community * - - {#if data.community} - - {/if} -
+ {#if !data.community} { const c = e.detail if (!c) { @@ -239,11 +224,35 @@ return } - data.community = c.id - communitySearch = `${c.name}@${new URL(c.actor_id).hostname}` + communitySearch = '' + + data.community = c }} /> -
+ {:else} +
+ Community + +
+ {/if} {/if} { if (browser) - setSessionStorage('lastSeenCommunity', { - id: data.community.community_view.community.id, - name: fullCommunityName( - data.community.community_view.community.name, - data.community.community_view.community.actor_id - ), - }) + setSessionStorage( + 'lastSeenCommunity', + data.community.community_view.community + ) }) onDestroy(() => { diff --git a/src/routes/post/[instance]/[id=integer]/+page.svelte b/src/routes/post/[instance]/[id=integer]/+page.svelte index 40440de4..8cfdbb61 100644 --- a/src/routes/post/[instance]/[id=integer]/+page.svelte +++ b/src/routes/post/[instance]/[id=integer]/+page.svelte @@ -161,8 +161,6 @@ community={post.post_view.community} user={post.post_view.creator} bind:subscribed={post.community_view.subscribed} - upvotes={post.post_view.counts.upvotes} - downvotes={post.post_view.counts.downvotes} deleted={post.post_view.post.deleted} removed={post.post_view.post.removed} locked={post.post_view.post.locked}