Fix parsing posts and userdata: admin flag removed in recent versions of Lemmy

See: https://github.com/LemmyNet/lemmy/pull/3403

For now, I guess we can try parsing the flag if it's present, and fall
back on assuming the associated user is *not* an admin.
This commit is contained in:
Stefan Zwanenburg 2023-09-11 11:09:46 +02:00
parent 9406f29562
commit caf4f177d2
2 changed files with 2 additions and 2 deletions

View File

@ -188,7 +188,7 @@ public class ParsePost {
boolean nsfw = post.getBoolean("nsfw");
boolean locked = post.getBoolean("locked");
boolean saved = data.getBoolean("saved");
String distinguished = (creator.getBoolean("admin") ? "admin" : "");
String distinguished = creator.optBoolean("admin") ? "admin" : "";
String suggestedSort = "";
ArrayList<Post.Preview> previews = new ArrayList<>();
if (!post.isNull("thumbnail_url")) {

View File

@ -48,7 +48,7 @@ public class ParseUserData {
boolean isBot = personJson.getBoolean("bot_account");
boolean isBanned = personJson.getBoolean("banned");
boolean isLocal = personJson.getBoolean("local");
boolean isAdmin = personJson.getBoolean("admin");
boolean isAdmin = personJson.optBoolean("admin");
boolean isDeleted = personJson.getBoolean("deleted");
String description = "";