fix(lists): send requests for list membership

Fixes a regression in 0af8dbf09b, where
lists memberships where not saved, as the requests where not send to the
server.
This commit is contained in:
FineFindus 2024-04-30 18:21:23 +02:00
parent d5cd016776
commit f7d0bda90f
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
1 changed files with 11 additions and 10 deletions

View File

@ -18,6 +18,7 @@ import com.squareup.otto.Subscribe;
import org.joinmastodon.android.E;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.MastodonAPIRequest;
import org.joinmastodon.android.api.ResultlessMastodonAPIRequest;
import org.joinmastodon.android.api.requests.lists.AddAccountsToList;
import org.joinmastodon.android.api.requests.lists.CreateList;
import org.joinmastodon.android.api.requests.lists.GetLists;
@ -120,16 +121,16 @@ public class ListsFragment extends MastodonRecyclerFragment<FollowList> implemen
private void saveListMembership(String listId, boolean isMember) {
userInList.put(listId, isMember);
List<String> accountIdList = Collections.singletonList(profileAccountId);
// MastodonAPIRequest<Object> req = (MastodonAPIRequest<Object>) (isMember ? new AddAccountsToList(listId, accountIdList) : new RemoveAccountsFromList(listId, accountIdList));
// req.setCallback(new Callback<>() {
// @Override
// public void onSuccess(Object o) {}
//
// @Override
// public void onError(ErrorResponse error) {
// error.showToast(getContext());
// }
// }).exec(accountID);
ResultlessMastodonAPIRequest req = isMember ? new AddAccountsToList(listId, accountIdList) : new RemoveAccountsFromList(listId, accountIdList);
req.setCallback(new Callback<>() {
@Override
public void onSuccess(Void o) {}
@Override
public void onError(ErrorResponse error) {
error.showToast(getContext());
}
}).exec(accountID);
}
@Override