Skip to content

Commit

Permalink
🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
adlered committed Oct 8, 2024
1 parent 7e80c6f commit 024a0fe
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/org/b3log/symphony/processor/FollowProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ public void followUser(final RequestContext context) {

final JSONObject requestJSONObject = context.requestJSON();
final String followingUserId = requestJSONObject.optString(Follow.FOLLOWING_ID);
final JSONObject currentUser = Sessions.getUser();
JSONObject currentUser = Sessions.getUser();
try {
currentUser = ApiProcessor.getUserByKey(requestJSONObject.optString("apiKey"));
} catch (NullPointerException ignored) {
}
final String followerUserId = currentUser.optString(Keys.OBJECT_ID);

followMgmtService.followUser(followerUserId, followingUserId);
Expand Down Expand Up @@ -149,7 +153,11 @@ public void unfollowUser(final RequestContext context) {
context.renderJSON(StatusCodes.SUCC);
final JSONObject requestJSONObject = context.requestJSON();
final String followingUserId = requestJSONObject.optString(Follow.FOLLOWING_ID);
final JSONObject currentUser = Sessions.getUser();
JSONObject currentUser = Sessions.getUser();
try {
currentUser = ApiProcessor.getUserByKey(requestJSONObject.optString("apiKey"));
} catch (NullPointerException ignored) {
}
final String followerUserId = currentUser.optString(Keys.OBJECT_ID);
followMgmtService.unfollowUser(followerUserId, followingUserId);
}
Expand Down

0 comments on commit 024a0fe

Please sign in to comment.