From 7be8e96ea13684d0b8e1fb0008cb69a5ff110e5c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 20 Sep 2018 00:04:35 +0300 Subject: ActivityStreams: preferredUsername --- .../src/main/java/com/juick/server/api/activity/Profile.java | 3 +++ .../main/java/com/juick/server/api/activity/model/Person.java | 9 +++++++++ 2 files changed, 12 insertions(+) (limited to 'juick-server/src/main') diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java index 4f81c4fb..b7098355 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java @@ -48,6 +48,7 @@ public class Profile { person.setId(uri.toUriString()); person.setUrl(uri.toUriString()); person.setName(userName); + person.setPreferredUsername(userName); Key publicKey = new Key(); publicKey.setId(person.getId() + "#main-key"); publicKey.setOwner(person.getId()); @@ -160,6 +161,7 @@ public class Profile { result.setOrderedItems(followersPage.map(a -> { Person follower = new Person(); follower.setName(a.getName()); + person.setPreferredUsername(a.getName()); follower.setUrl(uriComponentsBuilder.replacePath(String.format("/u/%s", a.getName())).toUriString()); return follower; }).collect(Collectors.toList())); @@ -196,6 +198,7 @@ public class Profile { Person person = new Person(); person.setName(user.getName()); + person.setPreferredUsername(user.getName()); OrderedCollectionPage result = new OrderedCollectionPage(); result.setId(ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString()); result.setOrderedItems(followingPage.map(a -> { diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Person.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Person.java index b7bc6547..e314624d 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/Person.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/Person.java @@ -3,6 +3,7 @@ package com.juick.server.api.activity.model; public class Person extends ActivityObject { private String name; + private String preferredUsername; private Image icon; private String inbox; private String outbox; @@ -79,4 +80,12 @@ public class Person extends ActivityObject { public void setPublicKey(Key publicKey) { this.publicKey = publicKey; } + + public String getPreferredUsername() { + return preferredUsername; + } + + public void setPreferredUsername(String preferredUsername) { + this.preferredUsername = preferredUsername; + } } -- cgit v1.2.3