From e377357b00cdb151aa20d96a0ce7a5f1a8bbe9c9 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Thu, 12 Jan 2023 11:46:40 +0300
Subject: Telegram: parse_mode=html
---
src/main/java/com/juick/CommandsManager.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
(limited to 'src/main/java/com/juick/CommandsManager.java')
diff --git a/src/main/java/com/juick/CommandsManager.java b/src/main/java/com/juick/CommandsManager.java
index 6b33cf16..e01e5020 100644
--- a/src/main/java/com/juick/CommandsManager.java
+++ b/src/main/java/com/juick/CommandsManager.java
@@ -65,6 +65,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.text.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
/**
@@ -93,6 +94,8 @@ public class CommandsManager {
private ApplicationEventPublisher applicationEventPublisher;
@Inject
private WebApp webApp;
+ @Value("${web_domain:localhost}")
+ private String webDomain;
@Inject
private ActivityPubManager activityPubManager;
@@ -160,7 +163,7 @@ public class CommandsManager {
SystemActivity.message(user, msg, subscriptionService.getSubscribedUsers(msg.getUser().getUid(), msg))));
return CommandResult.build(msg,
"New message posted.\n#" + msg.getMid() + " https://juick.com/m/" + msg.getMid(),
- String.format("[New message](%s) posted", PlainTextFormatter.formatUrl(msg)));
+ String.format("New message posted", PlainTextFormatter.formatUrl(msg)));
}
@UserCommand(pattern = "^ping$", patternFlags = Pattern.CASE_INSENSITIVE,
@@ -455,7 +458,7 @@ public class CommandsManager {
return CommandResult.fromString(replies.stream()
.map(PlainTextFormatter::formatPostSummary).collect(Collectors.joining("\n")));
}
- return CommandResult.fromString(PlainTextFormatter.formatPost(msg.get()));
+ return CommandResult.fromString(PlainTextFormatter.formatPost(msg.get(), webDomain));
}
return CommandResult.fromString("Message not found");
}
@@ -465,7 +468,7 @@ public class CommandsManager {
int rid = NumberUtils.toInt(arguments[1], 0);
Message reply = messagesService.getReply(mid, rid);
if (reply != null) {
- return CommandResult.fromString(PlainTextFormatter.formatPost(reply));
+ return CommandResult.fromString(PlainTextFormatter.formatPost(reply, webDomain));
}
return CommandResult.fromString("Reply not found");
}
@@ -596,7 +599,7 @@ public class CommandsManager {
subscriptionService.getUsersSubscribedToComments(original, reply))));
return CommandResult.build(reply, "Reply posted.\n#" + mid + "/" + newrid + " "
+ "https://juick.com/m/" + mid + "#" + newrid,
- String.format("[Reply](%s) posted", PlainTextFormatter.formatUrl(reply)));
+ String.format("Reply posted", PlainTextFormatter.formatUrl(reply)));
} else {
return CommandResult.fromString("Message is read-only");
}
--
cgit v1.2.3