Skip to content

Commit

Permalink
Indentation added
Browse files Browse the repository at this point in the history
  • Loading branch information
venkatesh2k3 committed Jul 2, 2024
1 parent 674a67b commit 5fb546a
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/main/java/ai/elimu/web/SignOnControllerDiscord.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,10 @@ public String handleCallback(HttpServletRequest request) throws IOException, Int
String id = String.valueOf(idAsLong);
contributor.setProviderIdDiscord(id);
}
private static final String DEFAULT_AVATAR_URL = "https://e7.pngegg.com/pngimages/84/165/"
+ "png-clipart-united-states-avatar-organization-information"
+ "-user-avatar-service-computer-wallpaper-thumbnail.png";


if (jsonObject.has("avatar")) {
if (jsonObject.get("avatar") instanceof String) {
String avatar = jsonObject.getString("avatar");
if (!avatar.isEmpty()) {
String uriAvatar = "https://cdn.discordapp.com/avatars/" + jsonObject.getLong("id") + "/" + avatar + ".png";
logger.info(uriAvatar);
contributor.setImageUrl(uriAvatar);
} else {
contributor.setImageUrl(DEFAULT_AVATAR_URL);
}
} else {
logger.warn("Avatar field is not a string: " + jsonObject.get("avatar"));
contributor.setImageUrl(DEFAULT_AVATAR_URL);
}
if (!jsonObject.isNull("avatar")) {
String uriAvatar = "https://cdn.discordapp.com/avatars/" + jsonObject.getLong("id") + "/" + jsonObject.getString("avatar") + ".png";
logger.info("Avatar URL: " + uriAvatar);

Check warning on line 137 in src/main/java/ai/elimu/web/SignOnControllerDiscord.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/web/SignOnControllerDiscord.java#L137

Added line #L137 was not covered by tests
contributor.setImageUrl(uriAvatar);
}
if (jsonObject.has("username")) {
contributor.setFirstName(jsonObject.getString("username"));
Expand Down Expand Up @@ -203,4 +188,4 @@ public String handleCallback(HttpServletRequest request) throws IOException, Int
return "redirect:/content";
}
}
}
}

0 comments on commit 5fb546a

Please sign in to comment.