aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server/api')
-rw-r--r--src/main/java/com/juick/server/api/activity/Profile.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/api/activity/Profile.java b/src/main/java/com/juick/server/api/activity/Profile.java
index 8e735642..9aa9dc37 100644
--- a/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/src/main/java/com/juick/server/api/activity/Profile.java
@@ -323,8 +323,7 @@ public class Profile {
String attachmentUrl = attachment.get("url");
String attachmentName = attachment.get("name");
return PlainTextFormatter.markdownUrl(attachmentUrl, attachmentName);
- }).reduce((source, url) -> String.format("%s\n%s", source, url))
- .orElse(markdown);
+ }).reduce(markdown, (currentUrl, nextUrl) -> String.format("%s\n%s", currentUrl, nextUrl));
CommandResult result = commandsManager.processCommand(
user, String.format("#%s %s", postId, commandBody),
@@ -342,14 +341,14 @@ public class Profile {
User user = new User();
user.setUri(URI.create(activity.getActor()));
String markdown = remarkConverter.convertFragment((String)note.get("content"));
+ // combine note text with attachment urls
String commandBody = note.get("attachment") == null ? markdown :
((List<Object>) note.get("attachment")).stream().map(attachmentObj -> {
Map<String, String> attachment = (Map<String, String>) attachmentObj;
String attachmentUrl = attachment.get("url");
String attachmentName = attachment.get("name");
return PlainTextFormatter.markdownUrl(attachmentUrl, attachmentName);
- }).reduce((source, url) -> String.format("%s\n%s", source, url))
- .orElse(markdown);
+ }).reduce(markdown, (currentUrl, nextUrl) -> String.format("%s\n%s", currentUrl, nextUrl));
CommandResult result = commandsManager.processCommand(
user,
String.format("#%d/%d %s", reply.getMid(), reply.getRid(), commandBody),