From 2a64e080a395170875d62d3bebaf4dce3815bb13 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 3 Nov 2018 13:14:15 +0300 Subject: ActivityPub: mentions with @user@server.tld --- .../src/main/java/com/juick/server/ActivityPubManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'juick-server/src/main/java/com/juick/server/ActivityPubManager.java') 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 0cb76a03..6f5163cc 100644 --- a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java +++ b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java @@ -262,6 +262,15 @@ public class ActivityPubManager implements ActivityListener, NotificationListene } else if (MessageUtils.isReply(msg)) { note.getTags().add(new Mention(personWebUri(msg.getTo()), msg.getTo().getName())); } + MessageUtils.getGlobalMentions(msg).forEach(m -> { + // @user@server.tld -> user@server.tld + Optional personContext = signatureManager.discoverPerson(m.substring(1)); + if (personContext.isPresent()) { + Person person = (Person) personContext.get(); + note.getTags().add(new Mention(person.getUrl(), person.getPreferredUsername())); + note.getCc().add(person.getUrl()); + } + }); if (msg.isHtml()) { note.setContent(msg.getText()); } else { -- cgit v1.2.3