Remove message and topic descriptions

This commit is contained in:
Steven Nguyen committed 2024-02-02 03:26:15 +00:00
1 parent 4d65629db7
commit f65d946ebc
10 files changed
+3 -113

No files matched your search

@@ -39,7 +39,6 @@
topics: $message.topics,
users: $message.users,
targets: $message.targets,
description: $message.description,
status: MessageStatuses.DRAFT,
scheduledAt: $message.scheduledAt
};
@@ -6,7 +6,6 @@ export const showCreate = writable(false);
export const columns = writable<Column[]>([
{ id: '$id', title: 'Message ID', type: 'string', show: true, width: 140 },
{ id: 'description', title: 'Description', type: 'string', show: true, width: 140 },
{ id: 'message', title: 'Message', type: 'string', show: false, filter: false, width: 140 },
{ id: 'providerType', title: 'Type', type: 'string', show: true, width: 100 },
{ id: 'status', title: 'Status', type: 'string', show: true, width: 120 },
@@ -12,7 +12,7 @@
const dispatch = createEventDispatcher();
let name: string, description: string, id: string, error: string;
let name: string, id: string, error: string;
let showCustomId = false;
const create = async () => {
@@ -27,12 +27,10 @@
},
{
name,
description: description || undefined,
topicId: id ?? ID.unique()
}
);
name = '';
description = '';
showCreate = false;
showCustomId = false;
addNotification({
@@ -64,12 +62,6 @@
autofocus={true}
required
bind:value={name} />
<InputText
id="description"
label="Description"
placeholder="Enter description"
bind:value={description}>
</InputText>
{#if !showCustomId}
<div>
<Pill button on:click={() => (showCustomId = !showCustomId)}
@@ -6,7 +6,6 @@ export const showCreate = writable(false);
export const columns = writable<Column[]>([
{ id: '$id', title: 'Topic ID', type: 'string', show: true, width: 140 },
{ id: 'name', title: 'Name', type: 'string', show: true, width: 140 },
{ id: 'description', title: 'Description', type: 'string', show: true, width: 140 },
{ id: 'total', title: 'Subscribers', type: 'integer', show: true, width: 140 },
{ id: '$createdAt', title: 'Created', type: 'datetime', show: true, width: 140 }
]);
@@ -2,13 +2,11 @@
import { Container } from '$lib/layout';
import DangerZone from './dangerZone.svelte';
import Details from './details.svelte';
import UpdateDescription from './updateDescription.svelte';
import UpdateName from './updateName.svelte';
</script>
<Container>
<Details />
<UpdateName />
<UpdateDescription />
<DangerZone />
</Container>
@@ -1,65 +0,0 @@
<script lang="ts">
import { CardGrid, Heading } from '$lib/components';
import { Button, Form, InputText } from '$lib/elements/forms';
import { onMount } from 'svelte';
import { topic } from './store';
import { invalidate } from '$app/navigation';
import { trackEvent, Submit, trackError } from '$lib/actions/analytics';
import { Dependencies } from '$lib/constants';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
let description: string = null;
onMount(async () => {
description ??= $topic.description;
});
async function updateDescription() {
try {
await sdk.forProject.client.call(
'PATCH',
new URL(`${sdk.forProject.client.config.endpoint}/messaging/topics/${$topic.$id}`),
{
'X-Appwrite-Project': sdk.forProject.client.config.project,
'content-type': 'application/json',
'X-Appwrite-Mode': 'admin'
},
{
description
}
);
await invalidate(Dependencies.MESSAGING_TOPIC);
addNotification({
message: 'Description has been updated',
type: 'success'
});
trackEvent(Submit.MessagingTopicUpdateDescription);
} catch (error) {
addNotification({
message: error.message,
type: 'error'
});
trackError(error, Submit.MessagingTopicUpdateDescription);
}
}
</script>
<Form onSubmit={updateDescription}>
<CardGrid>
<Heading tag="h6" size="7">Description</Heading>
<svelte:fragment slot="aside">
<ul data-private>
<InputText
id="description"
label="Description"
placeholder="Enter description"
autocomplete={false}
bind:value={description} />
</ul>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={description === $topic.description} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -52,7 +52,6 @@
createEmailMessage({
topics: $messageParams[ProviderTypes.Email]?.topics || [],
targets: $messageParams[ProviderTypes.Email]?.targets || [],
description: $messageParams[ProviderTypes.Email]?.description || 'Test message',
status: MessageStatuses.PROCESSING,
messageId: ID.unique(),
// TODO: properly handle the test email address
@@ -126,13 +125,6 @@
Enable the HTML mode if your message contains HTML tags.
</svelte:fragment>
</InputSwitch>
<InputText
id="description"
label="Description"
placeholder="Enter description"
tooltip="Provide a summary of the message. Users won't see this description."
bind:value={$messageParams[$providerType]['description']}>
</InputText>
{#if $operation === 'create'}
{#if !showCustomId}
<div>
@@ -86,7 +86,6 @@
createPushMessage({
topics: $messageParams[ProviderTypes.Push]?.topics || [],
targets: $messageParams[ProviderTypes.Push]?.targets || [],
description: $messageParams[ProviderTypes.Push]?.description || 'Test push',
status: MessageStatuses.PROCESSING,
messageId: ID.unique(),
// TODO: properly handle the test email address
@@ -224,13 +223,6 @@
</Button>
</div>
</form>
<InputText
id="description"
label="Description"
placeholder="Enter description"
tooltip="Provide a summary of the message. Users won't see this description."
bind:value={$messageParams[$providerType]['description']}>
</InputText>
{#if $operation === 'create'}
{#if !showCustomId}
<div>
@@ -23,14 +23,7 @@
MessageStatuses,
operation
} from './store';
import {
Button,
FormList,
InputEmail,
InputRadio,
InputText,
InputTextarea
} from '$lib/elements/forms';
import { Button, FormList, InputEmail, InputRadio, InputTextarea } from '$lib/elements/forms';
import { Pill } from '$lib/elements';
import { CustomId, Modal } from '$lib/components';
import { user } from '$lib/stores/user';
@@ -51,7 +44,6 @@
createSMSMessage({
topics: $messageParams[ProviderTypes.Email]?.topics || [],
targets: $messageParams[ProviderTypes.Email]?.targets || [],
description: $messageParams[ProviderTypes.Email]?.description || 'Test message',
status: MessageStatuses.PROCESSING,
messageId: ID.unique(),
// TODO: properly handle the test email address
@@ -115,13 +107,6 @@
</svelte:fragment>
</Modal>
</div>
<InputText
id="description"
label="Description"
placeholder="Enter description"
tooltip="Provide a summary of the message. Users won't see this description."
bind:value={$messageParams[$providerType]['description']}>
</InputText>
{#if $operation === 'create'}
{#if !showCustomId}
<div>
@@ -1,6 +1,6 @@
import type { Models } from '@appwrite.io/console';
import { ProviderTypes } from '../providerType.svelte';
import { writable } from 'svelte/store';
import { ProviderTypes } from '../providerType.svelte';
export enum MessageStatuses {
DRAFT = 'draft',
@@ -15,7 +15,6 @@ export type MessageParams = {
topics: string[];
users: string[];
targets: string[];
description: string;
status: MessageStatuses;
scheduledAt?: string;
};