Skip to content

Commit f9e058f

Browse files
committed
remove single-library direct linking
1 parent b5165c6 commit f9e058f

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

src/lms/ui/LmsApplication.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "database/Session.hpp"
3737
#include "database/objects/Artist.hpp"
3838
#include "database/objects/Cluster.hpp"
39-
#include "database/objects/Directory.hpp"
4039
#include "database/objects/Release.hpp"
4140
#include "database/objects/TrackList.hpp"
4241
#include "database/objects/User.hpp"
@@ -152,7 +151,6 @@ namespace lms::ui
152151
int index;
153152
bool admin;
154153
std::optional<Wt::WString> title;
155-
std::optional<std::string> activeNavPath;
156154
} views[] = {
157155
{ "/artists", IdxExplore, false, Wt::WString::tr("Lms.Explore.artists") },
158156
{ "/artist", IdxExplore, false, std::nullopt },
@@ -162,7 +160,7 @@ namespace lms::ui
162160
{ "/tracklists", IdxExplore, false, Wt::WString::tr("Lms.Explore.tracklists") },
163161
{ "/tracklist", IdxExplore, false, std::nullopt },
164162
{ "/folders", IdxExplore, false, Wt::WString::tr("Lms.Explore.folders") },
165-
{ "/folder", IdxExplore, false, std::nullopt, "/folders" },
163+
{ "/folder", IdxExplore, false, std::nullopt },
166164
{ "/playqueue", IdxPlayQueue, false, Wt::WString::tr("Lms.PlayQueue.playqueue") },
167165
{ "/settings", IdxSettings, false, Wt::WString::tr("Lms.Settings.settings") },
168166
{ "/admin/libraries", IdxAdminLibraries, true, Wt::WString::tr("Lms.Admin.MediaLibraries.media-libraries") },
@@ -186,24 +184,14 @@ namespace lms::ui
186184
if (view.title)
187185
LmsApp->setTitle(*view.title);
188186

189-
LmsApp->doJavaScript(LmsApp->javaScriptClass() + ".updateActiveNav('" + view.activeNavPath.value_or(view.path) + "')");
187+
LmsApp->doJavaScript(LmsApp->javaScriptClass() + ".updateActiveNav('" + view.path + "')");
190188
return;
191189
}
192190
}
193191

194192
wApp->setInternalPath(defaultPath, true);
195193
}
196194

197-
std::string getFoldersNavPath(db::Session& session)
198-
{
199-
auto transaction{ session.createReadTransaction() };
200-
201-
const auto roots{ db::Directory::findRootDirectories(session) };
202-
if (roots.results.size() == 1)
203-
return "/folder/" + roots.results.front()->getId().toString();
204-
205-
return "/folders";
206-
}
207195
} // namespace
208196

209197
std::unique_ptr<Wt::WApplication> LmsApplication::create(const Wt::WEnvironment& env, db::IDb& db, LmsApplicationManager& appManager, AuthenticationBackend authBackend)
@@ -472,7 +460,7 @@ namespace lms::ui
472460
navbar->bindNew<Wt::WAnchor>("releases", Wt::WLink{ Wt::LinkType::InternalPath, "/releases" }, Wt::WString::tr("Lms.Explore.releases"));
473461
navbar->bindNew<Wt::WAnchor>("tracks", Wt::WLink{ Wt::LinkType::InternalPath, "/tracks" }, Wt::WString::tr("Lms.Explore.tracks"));
474462
navbar->bindNew<Wt::WAnchor>("tracklists", Wt::WLink{ Wt::LinkType::InternalPath, "/tracklists" }, Wt::WString::tr("Lms.Explore.tracklists"));
475-
navbar->bindNew<Wt::WAnchor>("folders", Wt::WLink{ Wt::LinkType::InternalPath, getFoldersNavPath(getDbSession()) }, Wt::WString::tr("Lms.Explore.folders"));
463+
navbar->bindNew<Wt::WAnchor>("folders", Wt::WLink{ Wt::LinkType::InternalPath, "/folders" }, Wt::WString::tr("Lms.Explore.folders"));
476464

477465
Filters* filters{ navbar->bindNew<Filters>("filters") };
478466
navbar->bindString("username", std::string{ getUserLoginName() }, Wt::TextFormat::Plain);

0 commit comments

Comments
 (0)