Fix marketplace add-on uninstall (#3042)

Instead of using the full id (`marketplace:123456`) the id without service prefix was used to lookup installed add-ons. This is not an issue if the network is available because then the information is request from the forum. If no network connection is present it obviously fails.

This also reduces the log level in the case of connection issues. ERROR is to much and the stack trace is not necessary.

Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
J-N-K 2022-07-14 22:49:37 +02:00 committed by GitHub
parent 0b7fc242d4
commit 16cf5a8ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,7 +189,7 @@ public class CommunityMarketplaceAddonService extends AbstractRemoteAddonService
.filter(t -> showUnpublished || Arrays.asList(t.tags).contains(PUBLISHED_TAG))
.map(t -> convertTopicItemToAddon(t, users)).forEach(addons::add);
} catch (Exception e) {
logger.error("Unable to retrieve marketplace add-ons", e);
logger.warn("Unable to retrieve marketplace add-ons: {}", e.getMessage());
}
return addons;
}
@ -199,7 +199,7 @@ public class CommunityMarketplaceAddonService extends AbstractRemoteAddonService
String fullId = ADDON_ID_PREFIX + id;
// check if it is an installed add-on (cachedAddons also contains possibly incomplete results from the remote
// side, we need to retrieve them from Discourse)
if (installedAddons.contains(id)) {
if (installedAddons.contains(fullId)) {
return cachedAddons.stream().filter(e -> fullId.equals(e.getId())).findAny().orElse(null);
}