fix: event webhooks subscribed to a renamed event vanish after upgrading (#35417)

Several events were renamed, and admin event webhooks saved under the old names were treated as invalid: they disappeared from the webhook list, stopped firing, and were deleted the next time any webhook was saved. Creating a notification target with an old name was refused as well. Old event names are now accepted and translated to the new ones, for event webhooks and notification targets alike, as was already done for an earlier rename.

Fixes #35413
This commit is contained in:
Classic298 authored and GitHub committed 2026-12-01 02:33:19 +04:00
1 parent d56c3f304c
commit 35564622fe
2 files changed
+19 -3

No files matched your search

+17 -1
View File
@@ -20,7 +20,23 @@ log = logging.getLogger(__name__)
MAX_STRING_LENGTH = 1000
EVENT_WEBHOOKS_CONFIG_KEY = 'events.webhooks'
# Renamed events, so saved webhook filters that name the old event keep working (and are not skipped as invalid).
LEGACY_EVENT_NAMES = {'config.terminal_servers.updated': 'config.machines.updated'}
LEGACY_EVENT_NAMES = {
'config.terminal_servers.updated': 'config.machines.updated',
'auth.signup': 'auth.signed_up',
'auth.login': 'auth.logged_in',
'auth.logout': 'auth.logged_out',
'chat.finished': 'chat.response_completed',
'chat.failed': 'chat.response_failed',
'chat.deleted_all': 'chat.all_deleted',
'channel.message': 'channel.message_posted',
'file.deleted_all': 'file.all_deleted',
'function.enable_started': 'function.enabling',
'function.disable_started': 'function.disabling',
'calendar.alert': 'calendar.alert_triggered',
'feedback.deleted_all': 'feedback.all_deleted',
'notification.test': 'notification.test_sent',
'notification.manual': 'notification.sent',
}
LEGACY_WEBHOOK_CONFIG_KEY = 'webhook_url'
DEFAULT_WEBHOOK_ID = 'default'
+2 -2
View File
@@ -6,7 +6,7 @@ import time
from typing import Any
from urllib.parse import urlparse, quote
from open_webui.events import EVENT_DEFINITIONS_BY_NAME, NOTIFICATION_EVENTS
from open_webui.events import EVENT_DEFINITIONS_BY_NAME, LEGACY_EVENT_NAMES, NOTIFICATION_EVENTS
from open_webui.models.config import Config
from open_webui.models.users import Users
from open_webui.retrieval.web.utils import validate_url
@@ -56,7 +56,7 @@ def _normalize_target(target: dict[str, Any], existing: dict[str, Any] | None =
raise ValueError('events must be a list')
cleaned_events = []
for event in events:
event = str(event)
event = LEGACY_EVENT_NAMES.get(str(event), str(event))
if event not in VALID_EVENTS:
raise ValueError(f'unsupported notification event: {event}')
if event not in cleaned_events: