ssb: Following calculation fixes. It was not handled appropriately if an account was encountered multiple times with decreasing depths.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m3s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m3s
This commit is contained in:
parent
2ff689aab0
commit
31b78e74df
21
src/ssb.db.c
21
src/ssb.db.c
@ -1277,7 +1277,7 @@ static int _following_compare(const void* a, const void* b)
|
||||
|
||||
static bool _has_following_entry(const char* id, following_t** list, int count)
|
||||
{
|
||||
return count ? bsearch(id, list, count, sizeof(following_t*), _following_compare) != 0 : false;
|
||||
return count ? bsearch(id, list, count, sizeof(following_t*), _following_compare) != NULL : false;
|
||||
}
|
||||
|
||||
static bool _add_following_entry(following_t*** list, int* count, following_t* add)
|
||||
@ -1432,21 +1432,22 @@ static void _populate_follows_and_blocks(tf_ssb_t* ssb, following_t* entry, foll
|
||||
static void _get_following(
|
||||
tf_ssb_t* ssb, following_t* entry, following_t*** following, int* following_count, int depth, int max_depth, block_node_t* active_blocks, bool include_blocks)
|
||||
{
|
||||
int old_depth = entry->depth;
|
||||
entry->depth = tf_min(depth, entry->depth);
|
||||
if (depth < max_depth && !entry->populated && !_is_blocked_by_active_blocks(entry->id, active_blocks))
|
||||
if (depth < max_depth && depth < old_depth)
|
||||
{
|
||||
entry->populated = true;
|
||||
_populate_follows_and_blocks(ssb, entry, following, following_count, active_blocks, include_blocks);
|
||||
|
||||
if (depth < max_depth)
|
||||
if (!_is_blocked_by_active_blocks(entry->id, active_blocks))
|
||||
{
|
||||
if (!entry->populated)
|
||||
{
|
||||
entry->populated = true;
|
||||
_populate_follows_and_blocks(ssb, entry, following, following_count, active_blocks, include_blocks);
|
||||
}
|
||||
|
||||
block_node_t blocks = { .entry = entry, .parent = active_blocks };
|
||||
for (int i = 0; i < entry->following_count; i++)
|
||||
{
|
||||
if (!_has_following_entry(entry->following[i]->id, entry->blocking, entry->blocking_count))
|
||||
{
|
||||
_get_following(ssb, entry->following[i], following, following_count, depth + 1, max_depth, &blocks, include_blocks);
|
||||
}
|
||||
_get_following(ssb, entry->following[i], following, following_count, depth + 1, max_depth, &blocks, include_blocks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user