mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
upgrades: Show notification to remind user to run updates manually
- This is needed as we don't have software updates step during first setup anymore. Tests: - Trigger first setup by removing /var/lib/plinth/plinth.sqlite3 and re-running the service. After completing the setup, a notification is shown with correct severity, title, app icon, message and options. Dismiss remove the notifications. 'Go to Software Updates' takes us to updates app. - After dismissing the notification, re-running the service does not show notification again. - Increasing the app version number also does not show notification again. - Re-running the app setup does not show notification again. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
ed3363105a
commit
7033b7cf1e
@ -132,6 +132,31 @@ class UpgradesApp(app_module.App):
|
|||||||
group='admin')
|
group='admin')
|
||||||
note.dismiss(should_dismiss=dismiss)
|
note.dismiss(should_dismiss=dismiss)
|
||||||
|
|
||||||
|
def _show_first_manual_update_notification(self):
|
||||||
|
"""After first setup, show notification to manually run updates."""
|
||||||
|
from plinth.notification import Notification
|
||||||
|
title = gettext_noop('Run software update manually')
|
||||||
|
message = gettext_noop(
|
||||||
|
'Automatic software update runs daily by default. For the first '
|
||||||
|
'time, manually run it now.')
|
||||||
|
data = {
|
||||||
|
'app_name': 'translate:' + gettext_noop('Software Update'),
|
||||||
|
'app_icon': 'fa-refresh'
|
||||||
|
}
|
||||||
|
actions = [{
|
||||||
|
'type': 'link',
|
||||||
|
'class': 'primary',
|
||||||
|
'text': gettext_noop('Go to {app_name}'),
|
||||||
|
'url': 'upgrades:index'
|
||||||
|
}, {
|
||||||
|
'type': 'dismiss'
|
||||||
|
}]
|
||||||
|
Notification.update_or_create(id='upgrades-first-manual-update',
|
||||||
|
app_id='upgrades', severity='info',
|
||||||
|
title=title, message=message,
|
||||||
|
actions=actions, data=data,
|
||||||
|
group='admin', dismissed=False)
|
||||||
|
|
||||||
def setup(self, old_version):
|
def setup(self, old_version):
|
||||||
"""Install and configure the app."""
|
"""Install and configure the app."""
|
||||||
super().setup(old_version)
|
super().setup(old_version)
|
||||||
@ -140,6 +165,10 @@ class UpgradesApp(app_module.App):
|
|||||||
if not old_version and not cfg.develop:
|
if not old_version and not cfg.develop:
|
||||||
privileged.enable_auto()
|
privileged.enable_auto()
|
||||||
|
|
||||||
|
# Request user to run manual update as a one time activity
|
||||||
|
if not old_version:
|
||||||
|
self._show_first_manual_update_notification()
|
||||||
|
|
||||||
# Update apt preferences whenever on first install and on version
|
# Update apt preferences whenever on first install and on version
|
||||||
# increment.
|
# increment.
|
||||||
privileged.setup()
|
privileged.setup()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user