Conversation
Make permission checking mode-aware and group missing perms by location. - Adjust server-wide permission list to depend on settings.UseThreads to avoid reporting irrelevant missing permissions. Append standard permissions after mode-specific ones. - In panel permission checks, treat a panel as using threads if either global settings or the panel enable threads. Use logic.ThreadPermissions for thread-mode channel checks and simplify assembled permission slices. - Add ThreadPermissions constant in bot/logic/discordpermissions.go for reuse. - Rewrite findMissingPermissions to return labeled missing-permission groups (panel channel, notification channel, transcript channel) instead of a flat list; check primary channel, optional notification channel (thread mode), and transcript channel, using channel-level and guild-level checks as appropriate. - Update reply formatting to render missing permissions grouped by location with a title and footer linking docs. These changes reduce false positives, centralize thread-mode permissions, and provide clearer error messages to users about where permissions are missing.
Replace local permission constants/usages with the centralized github.com/TicketsBot-cloud/common/botpermissions package across the codebase. Updated imports and calls to BuildPermissions to use botpermissions.StandardPermissions, MinimalPermissions, ThreadModeRequired, NotifChannelRequired, TranscriptChannelRequired, and ChannelModeRequired where appropriate. Removed duplicate permission arrays from bot/logic/discordpermissions.go and adjusted code to copy/append permission slices safely. Also enabled a local replace for the common module in go.mod. This centralizes permission definitions and reduces duplication.
Replace manual permission aggregation with botpermissions.EffectivePermissions and consolidate data fetching into fetchGuildData/fetchChannelData/buildRoleMap helpers. Simplifies HasPermissions/HasPermissionsChannel and GetMissingPermissions* by delegating to centralized logic, removes many in-file permission helpers, and updates imports accordingly. Keeps existing error handling (sentry) and preserves administrator short-circuit behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Make permission checking mode-aware and group missing perms by location.
These changes reduce false positives, centralize thread-mode permissions, and provide clearer error messages to users about where permissions are missing.
Needs: TicketsBot-cloud/common#5 ✓
Type of Change
Testing
Checklist