Fix bugs related to fetching blocked users

This commit is contained in:
Balazs Toldi 2023-08-12 21:02:44 +02:00
parent 23d41846d0
commit 7877001533
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
2 changed files with 7 additions and 4 deletions

View File

@ -40,7 +40,10 @@ public class FetchBlockedThings {
JSONObject blockedUserJson = blockedUsersJson.getJSONObject(i).getJSONObject("target");
int id = blockedUserJson.getInt("id");
String name = blockedUserJson.getString("name");
String avatar = blockedUserJson.getString("avatar");
String avatar = "";
if (blockedUserJson.has("avatar"))
avatar = blockedUserJson.getString("avatar");
String qualifiedName = LemmyUtils.actorID2FullName(blockedUserJson.getString("actor_id"));
BlockedUserData blockedUserData = new BlockedUserData(id, name, avatar, qualifiedName, accountName);

View File

@ -1094,8 +1094,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
mUserData = userData;
username = userData.getName();
setupVisibleElements();
new ViewUserDetailActivity.InsertUserDataAsyncTask(mRedditDataRoomDatabase.userDao(), userData,
() -> mFetchUserInfoSuccess = true).execute();
FetchBlockedThings.fetchBlockedThings(mRetrofit.getRetrofit(), mAccessToken, mAccountQualifiedName, new FetchBlockedThings.FetchBlockedThingsListener() {
@Override
@ -1108,13 +1106,15 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
}
isBlocked = false;
invalidateOptionsMenu();
}
@Override
public void onFetchBlockedThingsFailure() {
}
});
new ViewUserDetailActivity.InsertUserDataAsyncTask(mRedditDataRoomDatabase.userDao(), userData,
() -> mFetchUserInfoSuccess = true).execute();
}
@Override