mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat(messaging): only show topics that have related subscribers
This commit is contained in:
2 files changed
+13
-3
No files matched your search
@@ -28,6 +28,7 @@
|
||||
</DropList>
|
||||
|
||||
<TopicsModal
|
||||
{providerType}
|
||||
bind:show={showTopics}
|
||||
bind:topicsById={$topicsById}
|
||||
on:update={(e) => {
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
import { Button, FormList, InputCheckbox, InputSearch } from '$lib/elements/forms';
|
||||
import { Table, TableBody, TableCell, TableRow } from '$lib/elements/table';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Query, type Models } from '@appwrite.io/console';
|
||||
import { Query, type Models, MessagingProviderType } from '@appwrite.io/console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { providerType, getTotal } from './wizard/store';
|
||||
import { getTotal } from './wizard/store';
|
||||
import ProviderType from './providerType.svelte';
|
||||
|
||||
export let providerType: MessagingProviderType;
|
||||
export let show: boolean;
|
||||
export let topicsById: Record<string, Models.Topic>;
|
||||
export let title = 'Select topics';
|
||||
@@ -35,6 +36,14 @@
|
||||
if (!show) return;
|
||||
const queries = [Query.limit(5), Query.offset(offset)];
|
||||
|
||||
if (providerType === MessagingProviderType.Email) {
|
||||
queries.push(Query.greaterThan('emailTotal', 0));
|
||||
} else if (providerType === MessagingProviderType.Sms) {
|
||||
queries.push(Query.greaterThan('smsTotal', 0));
|
||||
} else if (providerType === MessagingProviderType.Push) {
|
||||
queries.push(Query.greaterThan('pushTotal', 0));
|
||||
}
|
||||
|
||||
const response = await sdk.forProject.messaging.listTopics(queries, search || undefined);
|
||||
|
||||
totalResults = response.total;
|
||||
@@ -84,7 +93,7 @@
|
||||
<Modal {title} bind:show onSubmit={submit} on:close={reset} headerDivider={false} size="big">
|
||||
<p class="text">
|
||||
Select existing topics you want to send this message to its targets. The message will be
|
||||
sent only to <ProviderType type={$providerType} noIcon /> targets.
|
||||
sent only to <ProviderType type={providerType} noIcon /> targets.
|
||||
</p>
|
||||
<InputSearch
|
||||
autofocus
|
||||
|
||||
Reference in new issue
Block a user