Merge pull request #360 from the-luap/fix/issue-hero-logo-position

fix(events): stop mapping branding_logo_position onto hero_logo_position
This commit is contained in:
Paul Nothaft
2026-05-02 00:07:24 +02:00
committed by GitHub
2 changed files with 30 additions and 6 deletions
@@ -0,0 +1,21 @@
/**
* Heal events whose hero_logo_position contains a branding-style value
* (left/right) caused by a prior bug in adminEvents.js getBrandingDefaults
* that mapped branding_logo_position (left/center/right) onto
* hero_logo_position (top/center/bottom). Any non-canonical value is
* reset to 'top' so subsequent PUTs no longer fail validation.
*/
exports.up = async function up(knex) {
const hasColumn = await knex.schema.hasColumn('events', 'hero_logo_position');
if (!hasColumn) return;
await knex('events')
.whereNotIn('hero_logo_position', ['top', 'center', 'bottom'])
.update({ hero_logo_position: 'top' });
};
exports.down = async function down() {
// Data correction is not reversible — the original (incorrect) values
// are not preserved.
};
+9 -6
View File
@@ -138,14 +138,20 @@ const getDownloadProtectionDefaults = async () => {
return { enable_devtools_protection: await readBooleanSetting('enable_devtools_protection') };
};
// Helper to get branding defaults for new events (Feature 7: Branding Inheritance)
// Helper to get branding defaults for new events (Feature 7: Branding Inheritance).
//
// Note: `branding_logo_position` (header bar — left/center/right) is a
// different concept from `hero_logo_position` (hero block — top/center/
// bottom) and must NOT be mapped here. A previous version copied the
// branding value over, which wrote 'left'/'right' into per-event
// hero_logo_position columns and broke any subsequent PUT validation
// (#357). Migration 084 heals existing rows.
const getBrandingDefaults = async () => {
try {
const settings = await db('app_settings')
.whereIn('setting_key', [
'branding_logo_display_hero',
'branding_logo_size',
'branding_logo_position'
'branding_logo_size'
])
.select('setting_key', 'setting_value');
@@ -166,9 +172,6 @@ const getBrandingDefaults = async () => {
if (s.setting_key === 'branding_logo_size' && value) {
defaults.hero_logo_size = value;
}
if (s.setting_key === 'branding_logo_position' && value) {
defaults.hero_logo_position = value;
}
});
return defaults;