Get all developer notifications that should be shown to a specific user. Evaluates conditions and user_level for each notification.
(user)
| 383 | |
| 384 | |
| 385 | def get_user_developer_notifications(user) -> list: |
| 386 | """ |
| 387 | Get all developer notifications that should be shown to a specific user. |
| 388 | Evaluates conditions and user_level for each notification. |
| 389 | """ |
| 390 | from core.models import SystemNotification |
| 391 | |
| 392 | # Get all active developer notifications |
| 393 | notifications = SystemNotification.objects.filter( |
| 394 | source=SystemNotification.Source.DEVELOPER, |
| 395 | is_active=True |
| 396 | ) |
| 397 | |
| 398 | # Filter by admin_only based on user |
| 399 | if getattr(user, 'user_level', 0) < 10: |
| 400 | notifications = notifications.filter(admin_only=False) |
| 401 | |
| 402 | # Filter by conditions |
| 403 | result = [] |
| 404 | for notification in notifications: |
| 405 | action_data = notification.action_data or {} |
| 406 | |
| 407 | # Evaluate conditions |
| 408 | conditions = action_data.get('condition', []) |
| 409 | if evaluate_conditions(conditions, user): |
| 410 | result.append(notification) |
| 411 | |
| 412 | return result |
nothing calls this directly
no test coverage detected