-
Notifications
You must be signed in to change notification settings - Fork 1
feat: role menu templates (#135) #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1483318
feat: add role_menu_templates migration (#135)
BillChirico 5c85f8c
feat: add roleMenuTemplates module with built-ins, CRUD, and share (#β¦
BillChirico 10d30af
feat: add /rolemenu command with template CRUD, apply, share (#135)
BillChirico 4cdd3d2
feat: seed built-in role menu templates on startup (#135)
BillChirico f5fa6b4
test: add roleMenuTemplates tests β 36 passing (#135)
BillChirico f158bf4
test: add /rolemenu command tests β 19 passing (#135)
BillChirico 5ea09bc
fix: typo hasModeatorPerms β hasModeratorPerms
BillChirico 7ecc70e
perf: SQL-based conversation pagination + missing DB indexes (#221)
BillChirico fd9c39a
feat: channel-level quiet mode via bot mention (#173) (#213)
BillChirico 23650ca
Fix: unterminated string in rolemenu.js
b0016e6
Fix: lint issues and formatting
320f6e2
Merge main into feat/issue-135
098e4d6
fix: deterministic template lookup and correct roleId precedence
ecfe3a2
fix: test assertion matches comment intent
4450a9f
fix: filter empty roleIds and only enable when valid options exist
ffc2c5d
chore: remove unused _MAX_DESCRIPTION_LEN constant
64acf4d
fix: case-insensitive unique index for template names
2e3d6ce
fix(roleMenuTemplates): add type validation for roleId and description
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /** | ||
| * Migration: Role Menu Templates | ||
| * | ||
| * Stores reusable role menu templates β both built-in (is_builtin=true) and | ||
| * custom guild-created templates. Shared templates (is_shared=true) are | ||
| * visible to every guild. | ||
| * | ||
| * @see https://github.com/VolvoxLLC/volvox-bot/issues/135 | ||
| */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| /** @param {import('node-pg-migrate').MigrationBuilder} pgm */ | ||
| exports.up = (pgm) => { | ||
| pgm.sql(` | ||
| CREATE TABLE IF NOT EXISTS role_menu_templates ( | ||
| id SERIAL PRIMARY KEY, | ||
| name TEXT NOT NULL, | ||
| description TEXT, | ||
| category TEXT NOT NULL DEFAULT 'custom', | ||
| created_by_guild_id TEXT, | ||
| is_builtin BOOLEAN NOT NULL DEFAULT FALSE, | ||
| is_shared BOOLEAN NOT NULL DEFAULT FALSE, | ||
| options JSONB NOT NULL DEFAULT '[]', | ||
| created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | ||
| updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | ||
| ) | ||
| `); | ||
|
|
||
| pgm.sql(` | ||
| CREATE UNIQUE INDEX IF NOT EXISTS idx_rmt_name_guild | ||
| ON role_menu_templates (LOWER(name), COALESCE(created_by_guild_id, '__builtin__')) | ||
| `); | ||
|
|
||
| pgm.sql(` | ||
| CREATE INDEX IF NOT EXISTS idx_rmt_guild | ||
| ON role_menu_templates (created_by_guild_id) | ||
| `); | ||
|
|
||
| pgm.sql(` | ||
| CREATE INDEX IF NOT EXISTS idx_rmt_shared | ||
| ON role_menu_templates (is_shared) WHERE is_shared = TRUE | ||
| `); | ||
| }; | ||
|
|
||
| /** @param {import('node-pg-migrate').MigrationBuilder} pgm */ | ||
| exports.down = (pgm) => { | ||
| pgm.sql('DROP TABLE IF EXISTS role_menu_templates CASCADE'); | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.