kopia lustrzana https://gitlab.com/mysocialportal/relatica
Fix bug in follower/following processing code.
rodzic
b9d9b7c533
commit
6589d4f572
|
@ -189,18 +189,16 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
final results = <String, Connection>{};
|
||||
var moreResults = true;
|
||||
var maxId = -1;
|
||||
const limit = 100;
|
||||
const limit = 1000;
|
||||
while (moreResults) {
|
||||
await client.getMyFollowers(sinceId: maxId, limit: limit).match(
|
||||
onSuccess: (followers) {
|
||||
if (followers.length < limit) {
|
||||
moreResults = false;
|
||||
for (final f in followers) {
|
||||
results[f.id] = f.copy(status: ConnectionStatus.theyFollowYou);
|
||||
int id = int.parse(f.id);
|
||||
maxId = max(maxId, id);
|
||||
}
|
||||
for (final f in followers) {
|
||||
results[f.id] = f.copy(status: ConnectionStatus.theyFollowYou);
|
||||
int id = int.parse(f.id);
|
||||
maxId = max(maxId, id);
|
||||
}
|
||||
moreResults = followers.length >= limit;
|
||||
}, onError: (error) {
|
||||
_logger.severe('Error getting followers data: $error');
|
||||
});
|
||||
|
@ -211,18 +209,16 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
while (moreResults) {
|
||||
await client.getMyFollowing(sinceId: maxId, limit: limit).match(
|
||||
onSuccess: (following) {
|
||||
if (following.length < limit) {
|
||||
moreResults = false;
|
||||
for (final f in following) {
|
||||
if (results.containsKey(f.id)) {
|
||||
results[f.id] = f.copy(status: ConnectionStatus.mutual);
|
||||
} else {
|
||||
results[f.id] = f.copy(status: ConnectionStatus.youFollowThem);
|
||||
}
|
||||
int id = int.parse(f.id);
|
||||
maxId = max(maxId, id);
|
||||
for (final f in following) {
|
||||
if (results.containsKey(f.id)) {
|
||||
results[f.id] = f.copy(status: ConnectionStatus.mutual);
|
||||
} else {
|
||||
results[f.id] = f.copy(status: ConnectionStatus.youFollowThem);
|
||||
}
|
||||
int id = int.parse(f.id);
|
||||
maxId = max(maxId, id);
|
||||
}
|
||||
moreResults = following.length >= limit;
|
||||
}, onError: (error) {
|
||||
_logger.severe('Error getting followers data: $error');
|
||||
});
|
||||
|
@ -232,6 +228,7 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
_myContacts.addAll(results.values);
|
||||
addAllConnections(results.values);
|
||||
_myContacts.sort((c1, c2) => c1.name.compareTo(c2.name));
|
||||
_logger.finest('# Contacts:${_myContacts.length}');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue