Add donation actions (rewards): menu editor + queue, donate-form buttons, overlay menu widget, alert lines
Test and Release / test (push) Successful in 1m43s
Test and Release / release (push) Successful in 7s

- Actions\Matcher (exact / every), ActionRepository, Recorder (idempotent via unique key)
- Admin: Rewards screen with live preview, queue with Mark done, menu badge
- Donate form shows actions as payment buttons; overlay 'actions' widget; alerts list triggered actions
- Installer DB_VERSION 2 (sg_actions, sg_action_events)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-15 12:36:28 -08:00
1 parent c62ac06b27
commit b0b5012698
25 files changed
+1227 -7

No files matched your search

+29 -1
View File
@@ -8,7 +8,7 @@ namespace StreamGoals\Core;
*/
final class Installer {
public const DB_VERSION = '1';
public const DB_VERSION = '2';
public static function activate(): void {
self::install_schema();
@@ -94,6 +94,34 @@ final class Installer {
PRIMARY KEY (goal_id,skey)
) $c;" );
dbDelta( "CREATE TABLE {$p}actions (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
goal_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
title VARCHAR(120) NOT NULL,
description VARCHAR(255) NOT NULL DEFAULT '',
amount_minor BIGINT UNSIGNED NOT NULL,
mode VARCHAR(8) NOT NULL DEFAULT 'exact',
enabled TINYINT(1) NOT NULL DEFAULT 1,
sort INT NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL,
PRIMARY KEY (id),
KEY goal_enabled (goal_id,enabled)
) $c;" );
dbDelta( "CREATE TABLE {$p}action_events (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
donation_id BIGINT UNSIGNED NOT NULL,
action_id BIGINT UNSIGNED NOT NULL,
times INT NOT NULL DEFAULT 1,
title VARCHAR(120) NOT NULL,
status VARCHAR(8) NOT NULL DEFAULT 'queued',
created_at DATETIME NOT NULL,
done_at DATETIME NULL,
PRIMARY KEY (id),
UNIQUE KEY donation_action (donation_id,action_id),
KEY status_id (status,id)
) $c;" );
update_option( 'sg_db_version', self::DB_VERSION );
}
}