[Servatrice] Log room channel messages in audit log (#7479)

* [Servatrice] Log room channel messages and bump schema to 38

* Fixup: show room_channel audit rows and keep migration nullable

The log history query returns room_channel rows, but the log tab
dropped them. Render them in the room table with an extra Channel
column. Also drop the NOT NULL on target_type from the 37->38
migration so migrated schemas match the nullable servatrice.sql
definition (and strict-mode ALTERs cannot fail on legacy NULL rows).
Update the channel tests to the flag-based privilege model: the admin
fixture now carries IsModerator alongside IsAdmin, as the database
layer assigns.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-16 22:46:39 +02:00 • committed by GitHub
parent c99113ab0e
commit ce51e7147d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 603 additions and 14 deletions

View file

@ -18,4 +18,12 @@ CREATE TABLE IF NOT EXISTS `cockatrice_rooms_channels` (
FOREIGN KEY(`id_room`) REFERENCES `cockatrice_rooms`(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci;
-- 2. Audit log: room_channel target type plus a channel column so moderators
-- can tell which stream a logged message belongs to.
ALTER TABLE `cockatrice_log`
MODIFY `target_type` ENUM('room', 'game', 'chat', 'room_channel');
ALTER TABLE `cockatrice_log`
ADD COLUMN `channel` varchar(50) NULL AFTER `target_name`;
UPDATE cockatrice_schema_version SET version=38 WHERE version=37;