Create a setting recommendation notification. This is a helper function that can be called from anywhere in the codebase. Args: setting_key: The setting key (e.g., 'proxy_settings.buffering_timeout') recommended_value: The recommended value for the setting reaso
(setting_key, recommended_value, reason, current_value=None)
| 991 | |
| 992 | |
| 993 | def create_setting_recommendation(setting_key, recommended_value, reason, current_value=None): |
| 994 | """ |
| 995 | Create a setting recommendation notification. |
| 996 | This is a helper function that can be called from anywhere in the codebase. |
| 997 | |
| 998 | Args: |
| 999 | setting_key: The setting key (e.g., 'proxy_settings.buffering_timeout') |
| 1000 | recommended_value: The recommended value for the setting |
| 1001 | reason: Why this setting is recommended |
| 1002 | current_value: The current value (optional) |
| 1003 | |
| 1004 | Returns: |
| 1005 | The created SystemNotification instance |
| 1006 | """ |
| 1007 | from core.models import SystemNotification |
| 1008 | from core.utils import send_websocket_notification |
| 1009 | |
| 1010 | notification, created = SystemNotification.create_setting_recommendation( |
| 1011 | setting_key=setting_key, |
| 1012 | recommended_value=recommended_value, |
| 1013 | reason=reason, |
| 1014 | current_value=current_value |
| 1015 | ) |
| 1016 | |
| 1017 | # Only send via WebSocket for newly created notifications |
| 1018 | if created: |
| 1019 | send_websocket_notification(notification) |
| 1020 | |
| 1021 | return notification |
| 1022 |
nothing calls this directly
no test coverage detected