From 8ec87c934616535da176c4c04c36e342c3496b12 Mon Sep 17 00:00:00 2001 From: emeric Date: Mon, 8 Oct 2018 13:37:25 +0200 Subject: [PATCH] Prevent demo user from saving radio/repeat states --- src/ui/PlayQueueView.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ui/PlayQueueView.cpp b/src/ui/PlayQueueView.cpp index dbd77680..0ee9fd88 100644 --- a/src/ui/PlayQueueView.cpp +++ b/src/ui/PlayQueueView.cpp @@ -81,7 +81,9 @@ PlayQueue::PlayQueue() updateRepeatBtn(); Wt::Dbo::Transaction transaction(LmsApp->getDboSession()); - LmsApp->getUser().modify()->setRepeatAll(_repeatAll); + + if (!LmsApp->getUser()->isDemo()) + LmsApp->getUser().modify()->setRepeatAll(_repeatAll); }); updateRepeatBtn(); @@ -93,7 +95,9 @@ PlayQueue::PlayQueue() updateRadioBtn(); Wt::Dbo::Transaction transaction(LmsApp->getDboSession()); - LmsApp->getUser().modify()->setRadio(_radioMode); + + if (!LmsApp->getUser()->isDemo()) + LmsApp->getUser().modify()->setRadio(_radioMode); }); updateRadioBtn(); @@ -116,12 +120,16 @@ PlayQueue::PlayQueue() updateInfo(); addSome(); - if (!LmsApp->getUser()->isDemo()) { - LmsApp->post([=] + Wt::Dbo::Transaction transaction(LmsApp->getDboSession()); + + if (!LmsApp->getUser()->isDemo()) { - load(LmsApp->getUser()->getCurPlayingTrackPos(), false); - }); + LmsApp->post([=] + { + load(LmsApp->getUser()->getCurPlayingTrackPos(), false); + }); + } } }