diff --git a/backend/app/http/endpoints/api/panel/panelcreate.go b/backend/app/http/endpoints/api/panel/panelcreate.go index e61ffb5a..79959ca9 100644 --- a/backend/app/http/endpoints/api/panel/panelcreate.go +++ b/backend/app/http/endpoints/api/panel/panelcreate.go @@ -124,13 +124,13 @@ func CreatePanel(c *gin.Context) { data.MessageId = 0 // Check panel quota - premiumTier, err := rpc.PremiumClient.GetTierByGuildId(c, guildId, false, botContext.Token, botContext.RateLimiter) + quotaTier, err := rpc.PremiumClient.GetTierByGuildId(c, guildId, false, botContext.Token, botContext.RateLimiter) if err != nil { _ = c.AbortWithError(http.StatusInternalServerError, app.NewError(err, "Failed to verify premium status")) return } - if premiumTier == premium.None { + if quotaTier == premium.None { panels, err := dbclient.Client.Panel.GetByGuild(c, guildId) if err != nil { _ = c.AbortWithError(http.StatusInternalServerError, app.NewError(err, "Failed to fetch existing panels")) @@ -165,11 +165,21 @@ func CreatePanel(c *gin.Context) { data.OverflowCategoryId = nil } + // Voting premium unlocks fields but not quota, so the tier is looked up twice. + featureTier := quotaTier + if featureTier == premium.None { + featureTier, err = rpc.PremiumClient.GetTierByGuildId(c, guildId, true, botContext.Token, botContext.RateLimiter) + if err != nil { + _ = c.AbortWithError(http.StatusInternalServerError, app.NewError(err, "Failed to verify premium status")) + return + } + } + // Do custom validation validationContext := PanelValidationContext{ Data: data, GuildId: guildId, - IsPremium: premiumTier > premium.None, + IsPremium: featureTier > premium.None, BotContext: botContext, Channels: channels, Roles: roles, diff --git a/frontend/src/pages/manage/panels/create.tsx b/frontend/src/pages/manage/panels/create.tsx index 104042ac..c61d6d15 100644 --- a/frontend/src/pages/manage/panels/create.tsx +++ b/frontend/src/pages/manage/panels/create.tsx @@ -73,8 +73,8 @@ const PanelsPage: FC = () => { const queryClient = useQueryClient(); const { data: forms = [] } = useGuildForms(guildId); const { data: premiumState = null } = useGuildPremium(guildId, false); - const { data: brandingPremium = null } = useGuildPremium(guildId, true); - const showBrandingFooter = !brandingPremium?.premium; + const { data: premiumWithVoting = null } = useGuildPremium(guildId, true); + const showBrandingFooter = !premiumWithVoting?.premium; const { data: kbCategories = [] } = useKBCategories(guildId); const { data: guildEmojis = [] } = useGuildEmojis(guildId, true); const [isLoadingClone, setIsLoadingClone] = useState(!!clonePanelId); @@ -464,26 +464,33 @@ const PanelsPage: FC = () => { } /> - c.type == 4) + .map((channel) => ({ + label: channel.name, + key: channel.id, + disabled: !premiumWithVoting?.premium, + })) || [] + } + value={panel.pending_category ?? null} + onChange={(e) => setPanel((prev) => (prev ? { ...prev, pending_category: e } : prev))} + /> +
c.type == 4) - .map((channel) => ({ - label: channel.name, - key: channel.id, - })) || [] - } - value={panel.pending_category || ""} - onChange={(e) => - setPanel((prev) => (prev ? { ...prev, pending_category: e ?? undefined } : prev)) - } - /> +
+
+ Awaiting Response Category + {!premiumWithVoting?.premium && ( + + + + )} +
+