aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-20 00:04:35 +0300
committerGravatar Vitaly Takmazov2018-09-20 00:04:35 +0300
commit7be8e96ea13684d0b8e1fb0008cb69a5ff110e5c (patch)
treec5cda94c1d8dad7545acb9a5cb01a679aa0ade30
parentb730ab2062091a9e1f0e1d8a5473a764800c1df5 (diff)
ActivityStreams: preferredUsername
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/Profile.java3
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/model/Person.java9
2 files changed, 12 insertions, 0 deletions
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;
+ }
}