MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / get_user_developer_notifications

Function get_user_developer_notifications

core/developer_notifications.py:385–412  ·  view source on GitHub ↗

Get all developer notifications that should be shown to a specific user. Evaluates conditions and user_level for each notification.

(user)

Source from the content-addressed store, hash-verified

383
384
385def 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

Callers

nothing calls this directly

Calls 3

evaluate_conditionsFunction · 0.85
filterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected