From 19826368ffb6ee1a2230f8745d9065487222506b Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Fri, 29 Jul 2022 12:23:24 +0100 Subject: [PATCH] Allow announcement channels for panels --- app/http/endpoints/api/panel/multipanelcreate.go | 2 +- app/http/endpoints/api/panel/panelcreate.go | 2 +- frontend/src/components/ChannelDropdown.svelte | 3 ++- .../src/components/manage/MultiPanelCreationForm.svelte | 2 +- frontend/src/components/manage/PanelCreationForm.svelte | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/http/endpoints/api/panel/multipanelcreate.go b/app/http/endpoints/api/panel/multipanelcreate.go index 2008dea..a333a80 100644 --- a/app/http/endpoints/api/panel/multipanelcreate.go +++ b/app/http/endpoints/api/panel/multipanelcreate.go @@ -163,7 +163,7 @@ func (d *multiPanelCreateData) validateChannel(guildId uint64) func() error { var valid bool for _, ch := range channels { - if ch.Id == d.ChannelId && ch.Type == channel.ChannelTypeGuildText { + if ch.Id == d.ChannelId && (ch.Type == channel.ChannelTypeGuildText || ch.Type == channel.ChannelTypeGuildNews) { valid = true break } diff --git a/app/http/endpoints/api/panel/panelcreate.go b/app/http/endpoints/api/panel/panelcreate.go index 53ca441..aa87e25 100644 --- a/app/http/endpoints/api/panel/panelcreate.go +++ b/app/http/endpoints/api/panel/panelcreate.go @@ -370,7 +370,7 @@ func (p *panelBody) getEmoji() *emoji.Emoji { func (p *panelBody) verifyChannel(channels []channel.Channel) bool { var valid bool for _, ch := range channels { - if ch.Id == p.ChannelId && ch.Type == channel.ChannelTypeGuildText { + if ch.Id == p.ChannelId && (ch.Type == channel.ChannelTypeGuildText || ch.Type == channel.ChannelTypeGuildNews) { valid = true break } diff --git a/frontend/src/components/ChannelDropdown.svelte b/frontend/src/components/ChannelDropdown.svelte index 2211baa..0bd276b 100644 --- a/frontend/src/components/ChannelDropdown.svelte +++ b/frontend/src/components/ChannelDropdown.svelte @@ -5,7 +5,7 @@ {/if} {#each channels as channel} - {#if channel.type === 0} + {#if channel.type === 0 || (allowAnnouncementChannel && channel.type === 5)} @@ -21,6 +21,7 @@ export let channels = []; export let withNull = false; export let nullLabel = "Disabled"; + export let allowAnnouncementChannel = false; $: value, ensureStringified(); diff --git a/frontend/src/components/manage/MultiPanelCreationForm.svelte b/frontend/src/components/manage/MultiPanelCreationForm.svelte index c1f0216..594e286 100644 --- a/frontend/src/components/manage/MultiPanelCreationForm.svelte +++ b/frontend/src/components/manage/MultiPanelCreationForm.svelte @@ -11,7 +11,7 @@
- +
diff --git a/frontend/src/components/manage/PanelCreationForm.svelte b/frontend/src/components/manage/PanelCreationForm.svelte index fbc7adc..8565ab4 100644 --- a/frontend/src/components/manage/PanelCreationForm.svelte +++ b/frontend/src/components/manage/PanelCreationForm.svelte @@ -16,8 +16,8 @@
- - + + {#each forms as form} @@ -314,7 +314,7 @@ teams: [], button_style: "1", form_id: "null", - channel_id: channels.find((c) => c.type === 0)?.id, + channel_id: channels.find((c) => c.type === 0 || c.type === 5)?.id, category_id: channels.find((c) => c.type === 4)?.id, use_server_default_naming_scheme: true, };