From bcb0823e7c49bbb9c0bdbaded20c19eb800d603b Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 15 Dec 2022 15:15:23 -0800 Subject: [PATCH] snapshot: Fix showing unsupported message on non-btrfs filesystems This is a regression from commit 9b6774f279e2c8af588609c2413aa9804fd48cfa. When change the view to use AppView, the condition to check for non-btrfs filesystems and show an unsupported message instead of the actual view was accidentally removed. Restore the check and show a different view when on non-btrfs filesystems. Fixes: #2268. Tests: - On non-btrfs filesystem, snapshots view is shown as expected. - On ext4 filesystem, a message that snapshots are not supported is shown. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/snapshot/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plinth/modules/snapshot/views.py b/plinth/modules/snapshot/views.py index 86f892f76..8fc4c5b6c 100644 --- a/plinth/modules/snapshot/views.py +++ b/plinth/modules/snapshot/views.py @@ -58,6 +58,13 @@ class SnapshotAppView(AppView): template_name = 'snapshot.html' form_class = SnapshotForm + def dispatch(self, request, *args, **kwargs): + """If snapshots are not supported, use a different view.""" + if not snapshot_module.is_supported(): + return not_supported_view(request) + + return super().dispatch(request, *args, **kwargs) + def get_initial(self): """Return the values to fill in the form.""" initial = super().get_initial()