From f6b78c029a1e9e4f09b600131e99bbc13c65f30a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 9 Jan 2023 09:45:12 +0300 Subject: Mastodon API: statuses --- .../com/juick/www/api/activity/helpers/ProfileUriBuilder.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java') diff --git a/src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java b/src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java index e10c3078..3f48502b 100644 --- a/src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java +++ b/src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java @@ -61,9 +61,16 @@ public record ProfileUriBuilder(String baseUri) { return messageUri(msg.getMid(), msg.getRid()); } + public static String messageId(Message msg) { + return messageId(msg.getMid(), msg.getRid()); + } + public static String messageId(int mid, int rid) { + return String.format("%d-%d", mid, rid); + } + public String messageUri(int mid, int rid) { UriComponentsBuilder uri = UriComponentsBuilder.fromUriString(baseUri); - uri.replacePath(String.format("/n/%d-%d", mid, rid)); + uri.replacePath("/n/" + messageId(mid, rid)); return uri.toUriString(); } -- cgit v1.2.3