diff --git a/src/lib/api/coves/client.ts b/src/lib/api/coves/client.ts index 6c1f94a0..0e427bf4 100644 --- a/src/lib/api/coves/client.ts +++ b/src/lib/api/coves/client.ts @@ -7,6 +7,7 @@ import type { CreateCommentInput, CreateCommentOutput, CreateCommunityInput, + CreateCommunityResponse, CreatePostInput, CreatePostOutput, CreateVoteInput, @@ -153,7 +154,9 @@ export class CovesClient { return this.xrpc.query(NSID.searchCommunities, params) } - createCommunity(input: CreateCommunityInput): Promise { + createCommunity( + input: CreateCommunityInput, + ): Promise { return this.xrpc.procedure(NSID.createCommunity, input) } diff --git a/src/lib/api/coves/types.ts b/src/lib/api/coves/types.ts index d6f9b86e..def0edd3 100644 --- a/src/lib/api/coves/types.ts +++ b/src/lib/api/coves/types.ts @@ -655,12 +655,18 @@ export interface UpdateCommentOutput { export interface CreateCommunityInput { name: string description: string - visibility: CommunityVisibility - displayName?: string + visibility?: CommunityVisibility language?: string allowExternalDiscovery?: boolean } +export interface CreateCommunityResponse { + uri: AtUri + cid: CID + did: DID + handle: Handle +} + export interface SubscribeCommunityInput { community: DID | Handle } diff --git a/src/lib/feature/community/CommunityForm.svelte b/src/lib/feature/community/CommunityForm.svelte index 53ffb8f0..2c8d388d 100644 --- a/src/lib/feature/community/CommunityForm.svelte +++ b/src/lib/feature/community/CommunityForm.svelte @@ -1,120 +1,60 @@ @@ -132,88 +72,26 @@ required label={$t('form.name')} bind:value={formData.name} + pattern={NAME_PATTERN} + minlength={1} + maxlength={63} oninput={() => { - formData.name = formData.name.toLowerCase().replaceAll(' ', '_') + formData.name = formData.name.toLowerCase().replaceAll(/[\s_]+/g, '-') }} - disabled={edit != undefined} /> - -
- - -
- {$t('post.badges.nsfw')} - - Only moderators can post - -
- - - {#if site.data} -
- - {#snippet target(attachment)} - - {/snippet} - {#each site.data.all_languages.filter((l) => !formData.languages?.includes(l.id)) as language (language.id)} - { - formData.languages = [ - ...(formData.languages ?? []), - language.id, - ] - }} - > - {language.name} - - {/each} - - {#each formData.languages ?? [] as languageId, index (languageId)} - {@const language = site.data.all_languages.find( - (l) => l.id == languageId, - )} - - {/each} -
- {/if} -
-
-