Add image_link field to community marketplace invididual add-ons (#2521)

When I ported over the code from the HABPanel gallery which was also
based on Discourse topics, the image_link field that was present on
topic lists wasn't replicated on single topic entries, but now it is:

See
https://meta.discourse.org/t/single-topic-api-endpoint-should-contain-image-url/131020
3201613f13

I have confirmed the field is present on community.openhab.org.
So this should help moving the "primary image" to the place where
the logo should be in the UI.

We can prevent the same image from being displayed twice with some
measures on the Discourse posts themselves
(like have it between <details></details>).

Signed-off-by: Yannick Schaus <github@schaus.net>
This commit is contained in:
Yannick Schaus 2021-10-15 17:47:54 +02:00 committed by GitHub
parent cffdcd04b3
commit 9d9dc70d89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -434,7 +434,7 @@ public class CommunityMarketplaceAddonService implements AddonService {
.anyMatch(handler -> handler.supports(type, contentType) && handler.isInstalled(id));
return Addon.create(id).withType(type).withContentType(contentType).withLabel(topic.title)
.withLink(COMMUNITY_TOPIC_URL + topic.id.toString())
.withImageLink(topic.image_url).withLink(COMMUNITY_TOPIC_URL + topic.id.toString())
.withAuthor(topic.post_stream.posts[0].display_username).withMaturity(maturity)
.withDetailedDescription(detailedDescription).withInstalled(installed).withProperties(properties)
.build();

View File

@ -27,6 +27,7 @@ public class DiscourseTopicResponseDTO {
public String title;
public Integer posts_count;
public String image_url;
public Date created_at;
public Date updated_at;