aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/juick/User.java2
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/User.java
index 84986010..f34f07a8 100644
--- a/src/main/java/com/juick/User.java
+++ b/src/main/java/com/juick/User.java
@@ -174,7 +174,7 @@ public class User {
@XmlTransient
@JsonIgnore
public boolean isAnonymous() {
- return false;
+ return uid == 0;
}
@Nonnull
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index a0d10988..3eb349e1 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -2002,4 +2002,9 @@ public class ServerTests {
assertThat(xnodeinfo.get("server"), notNullValue());
assertThat(xnodeinfo.get("software"), nullValue());
}
+ @Test
+ public void anonymousUserFromZero() {
+ User user = userService.getUserByUID(0).orElse(AnonymousUser.INSTANCE);
+ assertThat(user.isAnonymous(), is(true));
+ }
}