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

Function should_show_notification

core/developer_notifications.py:188–211  ·  view source on GitHub ↗

Determine if a notification should be shown to a specific user. Checks version range, user level, and conditions.

(notification_data: dict, user)

Source from the content-addressed store, hash-verified

186
187
188def should_show_notification(notification_data: dict, user) -> bool:
189 """
190 Determine if a notification should be shown to a specific user.
191 Checks version range, user level, and conditions.
192 """
193 # Check version range
194 if not is_version_in_range(
195 __version__,
196 notification_data.get('min_version'),
197 notification_data.get('max_version')
198 ):
199 return False
200
201 # Check user level
202 user_level = notification_data.get('user_level', 'all')
203 if user_level == 'admin' and getattr(user, 'user_level', 0) < 10:
204 return False
205
206 # Check conditions
207 conditions = notification_data.get('condition', [])
208 if not evaluate_conditions(conditions, user):
209 return False
210
211 return True
212
213
214# ─────────────────────────────

Callers

nothing calls this directly

Calls 3

is_version_in_rangeFunction · 0.85
evaluate_conditionsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected