Allow announcement channels for panels

This commit is contained in:
rxdn 2022-07-29 12:23:24 +01:00
parent 227049ef4d
commit 19826368ff
5 changed files with 8 additions and 7 deletions

View File

@ -163,7 +163,7 @@ func (d *multiPanelCreateData) validateChannel(guildId uint64) func() error {
var valid bool var valid bool
for _, ch := range channels { 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 valid = true
break break
} }

View File

@ -370,7 +370,7 @@ func (p *panelBody) getEmoji() *emoji.Emoji {
func (p *panelBody) verifyChannel(channels []channel.Channel) bool { func (p *panelBody) verifyChannel(channels []channel.Channel) bool {
var valid bool var valid bool
for _, ch := range channels { 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 valid = true
break break
} }

View File

@ -5,7 +5,7 @@
</option> </option>
{/if} {/if}
{#each channels as channel} {#each channels as channel}
{#if channel.type === 0} {#if channel.type === 0 || (allowAnnouncementChannel && channel.type === 5)}
<option value="{channel.id}"> <option value="{channel.id}">
#{channel.name} #{channel.name}
</option> </option>
@ -21,6 +21,7 @@
export let channels = []; export let channels = [];
export let withNull = false; export let withNull = false;
export let nullLabel = "Disabled"; export let nullLabel = "Disabled";
export let allowAnnouncementChannel = false;
$: value, ensureStringified(); $: value, ensureStringified();

View File

@ -11,7 +11,7 @@
<Colour col1={true} label="Panel Colour" on:change={updateColour} bind:value={tempColour}/> <Colour col1={true} label="Panel Colour" on:change={updateColour} bind:value={tempColour}/>
</div> </div>
<div class="col-2-3"> <div class="col-2-3">
<ChannelDropdown col1={true} {channels} label="Panel Channel" bind:value={data.channel_id}/> <ChannelDropdown col1 allowAnnouncementChannel {channels} label="Panel Channel" bind:value={data.channel_id}/>
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -16,8 +16,8 @@
</div> </div>
<div class="row"> <div class="row">
<Colour col4=true label="Panel Colour" on:change={updateColour} bind:value={tempColour}/> <Colour col4=true label="Panel Colour" on:change={updateColour} bind:value={tempColour}/>
<ChannelDropdown label="Panel Channel" col4=true {channels} bind:value={data.channel_id}/> <ChannelDropdown label="Panel Channel" allowAnnouncementChannel col4 {channels} bind:value={data.channel_id}/>
<CategoryDropdown label="Ticket Category" col4=true {channels} bind:value={data.category_id}/> <CategoryDropdown label="Ticket Category" col4 {channels} bind:value={data.category_id}/>
<Dropdown col4=true label="Form" bind:value={data.form_id}> <Dropdown col4=true label="Form" bind:value={data.form_id}>
<option value=null>None</option> <option value=null>None</option>
{#each forms as form} {#each forms as form}
@ -314,7 +314,7 @@
teams: [], teams: [],
button_style: "1", button_style: "1",
form_id: "null", 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, category_id: channels.find((c) => c.type === 4)?.id,
use_server_default_naming_scheme: true, use_server_default_naming_scheme: true,
}; };