Skip to content

Add submission blacklist - #46

Merged
BenHall-1 merged 1 commit into
masterfrom
submission-blacklist
Sep 27, 2026
Merged

BenHall-1 merged 1 commit into
masterfrom
submission-blacklist

Conversation

@biast12

@biast12 biast12 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Adds the submission_blacklist table. The dashboard uses it to block users and servers from gallery submissions, and users from integration review. Also fixes the bot-wide blacklist queries hiding database errors.

  • New SubmissionBlacklist table: feature, target_type, target_id, reason, primary key (feature, target_type, target_id).
    • Methods: IsBlacklisted (matches the user or the server, preferring the user), List, Add (an upsert of the reason) and Delete.
    • SubmissionFeature.AllowsTarget: gallery takes users and servers; integrations take users only.
    • Registered in Database/CreateTables and exempt from guild purge.
  • Audit codes: actions 450/451 (add/remove) and resource 39.
  • Fix: ServerBlacklist.ListAll, ServerBlacklist.ListAllEntries and GlobalBlacklist.ListAll now defer rows.Close() and return rows.Err(). On a warm connection, pgx reports query errors only through rows.Err(), so these returned an empty list with no error.
    • In the worker, the cache refresh then replaced the blacklist cache with that list, which unbanned everyone until the next refresh.
    • In the dashboard, the admin Server/Global Blacklist pages now show an error instead of an empty list.

SQL:

CREATE TABLE IF NOT EXISTS submission_blacklist(
      "feature" TEXT NOT NULL,
      "target_type" TEXT NOT NULL,
      "target_id" int8 NOT NULL,
      "reason" TEXT,
      PRIMARY KEY("feature", "target_type", "target_id")
);

For: TicketsBot-cloud/dashboard#153

Type of Change

  • Bug fix
  • New feature
  • Breaking change

Checklist

  • My code follows the style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Introduces feature- and target-scoped submission blacklist storage with gallery and integrations support, database wiring, audit resources, and guild purge exemptions. Also improves row cleanup and error propagation in blacklist listing methods.
@biast12
biast12 requested a review from a team as a code owner September 24, 2026 23:13
@github-actions github-actions Bot added type:bug Bug Fixes type:feature New Feature labels Sep 24, 2026
@BenHall-1
BenHall-1 merged commit 7a22c7b into master Sep 27, 2026
2 checks passed
@BenHall-1
BenHall-1 deleted the submission-blacklist branch September 27, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug Fixes type:feature New Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants