Create or update a version update notification. Returns (notification, created) tuple.
(cls, version, release_url=None, release_notes=None)
| 563 | |
| 564 | @classmethod |
| 565 | def create_version_notification(cls, version, release_url=None, release_notes=None): |
| 566 | """Create or update a version update notification. Returns (notification, created) tuple.""" |
| 567 | key = f"version-{version}" |
| 568 | notification, created = cls.objects.update_or_create( |
| 569 | notification_key=key, |
| 570 | defaults={ |
| 571 | 'notification_type': cls.NotificationType.VERSION_UPDATE, |
| 572 | 'priority': cls.Priority.HIGH, |
| 573 | 'title': f'Version {version} Available', |
| 574 | 'message': f'A new version of Dispatcharr ({version}) is available.', |
| 575 | 'action_data': { |
| 576 | 'version': version, |
| 577 | 'release_url': release_url, |
| 578 | 'release_notes': release_notes, |
| 579 | }, |
| 580 | 'is_active': True, |
| 581 | 'admin_only': True, |
| 582 | } |
| 583 | ) |
| 584 | return notification, created |
| 585 | |
| 586 | @classmethod |
| 587 | def create_setting_recommendation(cls, setting_key, recommended_value, reason, current_value=None): |
no outgoing calls
no test coverage detected