diff options
author | 2018-10-05 12:38:19 +0300 | |
---|---|---|
committer | 2018-10-05 12:38:19 +0300 | |
commit | 2379429b534ff5d93cb54f835e95a059fa5f3fc9 (patch) | |
tree | 42874e32185977ef50c7efbe14d71c1764d183af /juick-server/src/main/java/com/juick/server/ActivityPubManager.java | |
parent | 0a67254245046236f82733c95e84a23ffcfdc45c (diff) |
ActivityPub: forward attachment as Image
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/ActivityPubManager.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/ActivityPubManager.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java index cc63a4ce..3a32b4e5 100644 --- a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java +++ b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java @@ -2,6 +2,7 @@ package com.juick.server; import com.juick.Message; import com.juick.User; +import com.juick.server.api.activity.model.Image; import com.juick.server.api.activity.model.Link; import com.juick.server.api.activity.model.Note; import com.juick.server.api.activity.model.Person; @@ -9,6 +10,7 @@ import com.juick.server.api.activity.model.activities.Accept; import com.juick.server.api.activity.model.activities.Announce; import com.juick.server.api.activity.model.activities.Create; import com.juick.server.api.activity.model.activities.Delete; +import com.juick.server.util.HttpUtils; import com.juick.service.SocialService; import com.juick.service.UserService; import com.juick.service.activities.*; @@ -192,8 +194,10 @@ public class ActivityPubManager implements ActivityListener, NotificationListene note.setPublished(msg.getTimestamp()); note.setContent(MessageUtils.formatMessage(msg.getText())); if (StringUtils.isNotBlank(msg.getAttachmentType())) { - Link attachment = new Link(); - attachment.setHref(msg.getAttachment().getMedium().getUrl()); + Image attachment = new Image(); + attachment.setId(msg.getAttachment().getMedium().getUrl()); + attachment.setUrl(msg.getAttachment().getMedium().getUrl()); + attachment.setMediaType(HttpUtils.mediaType(msg.getAttachmentType())); note.setAttachment(attachment); } return note; |