aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server/api')
-rw-r--r--src/main/java/com/juick/server/api/Users.java14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/main/java/com/juick/server/api/Users.java b/src/main/java/com/juick/server/api/Users.java
index 0e0fee85..5c6efe0c 100644
--- a/src/main/java/com/juick/server/api/Users.java
+++ b/src/main/java/com/juick/server/api/Users.java
@@ -19,7 +19,6 @@ package com.juick.server.api;
import com.juick.User;
import com.juick.model.ApplicationStatus;
-import com.juick.model.UserInfo;
import com.juick.server.util.*;
import com.juick.server.www.WebApp;
import com.juick.service.*;
@@ -96,7 +95,7 @@ public class Users {
me.setRead(userService.getUserFriends(visitor.getUid()));
me.setReaders(userService.getUserReaders(visitor.getUid()));
me.setAvatar(webApp.getAvatarUrl(visitor));
- return me;
+ return (SecureUser)userService.getUserInfo(me);
}
@PostMapping("/api/me/upload")
public void updateInfo(@RequestParam MultipartFile avatar) throws IOException {
@@ -111,9 +110,6 @@ public class Users {
public List<User> doGetUserRead(
@RequestParam String uname) {
User visitor = UserUtils.getCurrentUser();
- if (visitor.isAnonymous()) {
- throw new HttpForbiddenException();
- }
int uid = 0;
if (uname == null) {
uid = visitor.getUid();
@@ -138,9 +134,6 @@ public class Users {
public List<User> doGetUserReaders(
@RequestParam String uname) {
User visitor = UserUtils.getCurrentUser();
- if (visitor.isAnonymous()) {
- throw new HttpForbiddenException();
- }
int uid = 0;
if (uname == null) {
uid = visitor.getUid();
@@ -162,7 +155,7 @@ public class Users {
}
@GetMapping("/api/info/{uname}")
- public UserInfo getUserInfo(@PathVariable String uname) {
+ public User getUserInfo(@PathVariable String uname) {
User user = userService.getUserByName(uname);
if (!user.isBanned()) {
user.setRead(doGetUserRead(uname));
@@ -177,9 +170,6 @@ public class Users {
public String getHash() {
return getAuthHash();
}
- public UserInfo getUserInfo() {
- return userService.getUserInfo(this);
- }
public List<String> getJIDs() {
return userService.getAllJIDs(this);
}