Do not write all the artists in case no album artist is found. ref #154
This commit is contained in:
@@ -107,25 +107,7 @@ Release::refreshView()
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<Wt::Dbo::ptr<Database::Artist>> artists;
|
||||
|
||||
artists = release->getReleaseArtists();
|
||||
if (artists.empty())
|
||||
artists = release->getArtists();
|
||||
|
||||
if (!artists.empty())
|
||||
{
|
||||
setCondition("if-has-release-artists", true);
|
||||
|
||||
Wt::WContainerWidget* artistsContainer {bindNew<Wt::WContainerWidget>("artists")};
|
||||
for (const auto& artist : artists)
|
||||
{
|
||||
Wt::WTemplate* artistTemplate {artistsContainer->addNew<Wt::WTemplate>(Wt::WString::tr("Lms.Explore.Release.template.entry-release-artist"))};
|
||||
artistTemplate->bindWidget("artist", LmsApplication::createArtistAnchor(artist));
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshReleaseArtists(release);
|
||||
|
||||
{
|
||||
Wt::WImage* cover {bindNew<Wt::WImage>("cover", Wt::WLink(LmsApp->getCoverResource()->getReleaseUrl(release.id(), CoverResource::Size::Large)))};
|
||||
@@ -263,6 +245,35 @@ Release::refreshView()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Release::refreshReleaseArtists(const Database::Release::pointer& release)
|
||||
{
|
||||
std::vector<Wt::Dbo::ptr<Database::Artist>> artists;
|
||||
|
||||
artists = release->getReleaseArtists();
|
||||
if (artists.empty())
|
||||
{
|
||||
artists = release->getArtists(Database::TrackArtistLinkType::Artist);
|
||||
if (artists.size() > 1)
|
||||
{
|
||||
setCondition("if-has-various-release-artists", true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!artists.empty())
|
||||
{
|
||||
setCondition("if-has-release-artists", true);
|
||||
|
||||
Wt::WContainerWidget* artistsContainer {bindNew<Wt::WContainerWidget>("artists")};
|
||||
for (const auto& artist : artists)
|
||||
{
|
||||
Wt::WTemplate* artistTemplate {artistsContainer->addNew<Wt::WTemplate>(Wt::WString::tr("Lms.Explore.Release.template.entry-release-artist"))};
|
||||
artistTemplate->bindWidget("artist", LmsApplication::createArtistAnchor(artist));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Release::refreshCopyright(const Database::Release::pointer& release)
|
||||
{
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace UserInterface
|
||||
|
||||
private:
|
||||
void refreshView();
|
||||
void refreshReleaseArtists(const Wt::Dbo::ptr<Database::Release>& release);
|
||||
void refreshCopyright(const Wt::Dbo::ptr<Database::Release>& release);
|
||||
void refreshLinks(const Wt::Dbo::ptr<Database::Release>& release);
|
||||
void refreshSimilarReleases(const std::unordered_set<Database::IdType>& similarReleasesId);
|
||||
|
||||
Reference in New Issue
Block a user