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"); JSONObject blockedUserJson = blockedUsersJson.getJSONObject(i).getJSONObject("target");
int id = blockedUserJson.getInt("id"); int id = blockedUserJson.getInt("id");
String name = blockedUserJson.getString("name"); 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")); String qualifiedName = LemmyUtils.actorID2FullName(blockedUserJson.getString("actor_id"));
BlockedUserData blockedUserData = new BlockedUserData(id, name, avatar, qualifiedName, accountName); BlockedUserData blockedUserData = new BlockedUserData(id, name, avatar, qualifiedName, accountName);

View File

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