From 3bad5a07a508808d8a2f3c4bd454d0bb547d5c9f Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 5 Nov 2023 00:17:23 +0200 Subject: [PATCH] fix hole action kinds --- files/helpers/config/holeaction_types.py | 9 +++++++-- files/routes/holes.py | 6 +++--- .../20231104-allow-multiple-sidebar-images-for-holes.sql | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/files/helpers/config/holeaction_types.py b/files/helpers/config/holeaction_types.py index c18a89a40..a85b04ec0 100644 --- a/files/helpers/config/holeaction_types.py +++ b/files/helpers/config/holeaction_types.py @@ -54,11 +54,16 @@ HOLEACTION_TYPES = { "icon": 'fa-image-slash', "color": 'bg-danger', }, - 'change_sidebar_image': { - "str": 'changed the sidebar image', + 'upload_sidebar_image': { + "str": 'uploaded a sidebar image', "icon": 'fa-image', "color": 'bg-primary' }, + 'delete_sidebar_image': { + "str": 'deleted a sidebar image', + "icon": 'fa-image-slash', + "color": 'bg-danger', + }, 'change_marsey': { "str": 'changed the hole marsey', "icon": 'fa-cat', diff --git a/files/routes/holes.py b/files/routes/holes.py index ffb98a762..030c69fa7 100644 --- a/files/routes/holes.py +++ b/files/routes/holes.py @@ -536,7 +536,7 @@ def upload_hole_sidebar(v, hole): ma = HoleAction( hole=hole.name, - kind='upload_sidebar', + kind='upload_sidebar_image', user_id=v.id ) g.db.add(ma) @@ -565,7 +565,7 @@ def delete_hole_sidebar(v, hole, index): ma = HoleAction( hole=hole.name, - kind='delete_sidebar', + kind='delete_sidebar_image', _note=index, user_id=v.id ) @@ -591,7 +591,7 @@ def delete_all_hole_sidebars(v, hole): ma = HoleAction( hole=hole.name, - kind='delete_sidebar', + kind='delete_sidebar_image', _note='all', user_id=v.id ) diff --git a/migrations/20231104-allow-multiple-sidebar-images-for-holes.sql b/migrations/20231104-allow-multiple-sidebar-images-for-holes.sql index 720da909b..a69df6b47 100644 --- a/migrations/20231104-allow-multiple-sidebar-images-for-holes.sql +++ b/migrations/20231104-allow-multiple-sidebar-images-for-holes.sql @@ -1,3 +1,4 @@ alter table holes add column sidebarurls character varying(60)[] default '{}'::character varying[] not null; update holes set sidebarurls = array_append(sidebarurls, sidebarurl) WHERE sidebarurl is not null; alter table holes drop column sidebarurl; +update hole_actions set kind='upload_sidebar_image' where kind='change_sidebar_image';