Skip to content

Commit

Permalink
load changelog and desc for available updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jan 14, 2025
1 parent 088fe2c commit 1d716fc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions loader/src/ui/mods/sources/ModSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ server::ServerModMetadata const* ModSource::asServer() const {

server::ServerRequest<std::optional<std::string>> ModSource::fetchAbout() const {
// todo: write as visit
if (auto mod = this->asMod()) {
return server::ServerRequest<std::optional<std::string>>::immediate(Ok(mod->getMetadata().getDetails()));
if(!this->hasUpdates()) {
if (auto mod = this->asMod()) {
return server::ServerRequest<std::optional<std::string>>::immediate(Ok(mod->getMetadata().getDetails()));
}
}
return server::getMod(this->getID()).map(
[](auto* result) -> Result<std::optional<std::string>, server::ServerError> {
Expand All @@ -145,8 +147,10 @@ server::ServerRequest<std::optional<std::string>> ModSource::fetchAbout() const
);
}
server::ServerRequest<std::optional<std::string>> ModSource::fetchChangelog() const {
if (auto mod = this->asMod()) {
return server::ServerRequest<std::optional<std::string>>::immediate(Ok(mod->getMetadata().getChangelog()));
if(!this->hasUpdates()) {
if (auto mod = this->asMod()) {
return server::ServerRequest<std::optional<std::string>>::immediate(Ok(mod->getMetadata().getChangelog()));
}
}
return server::getMod(this->getID()).map(
[](auto* result) -> Result<std::optional<std::string>, server::ServerError> {
Expand Down

1 comment on commit 1d716fc

@Nightcaat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love you

Please sign in to comment.