ssb: Hint at follow depth with profile image shape. Also, reload follow information the same way we re-determine channel unread status. Let's see if this feels good.

This commit is contained in:
2025-01-11 13:48:06 -05:00
parent 6b0c49752c
commit 02759c6f83
10 changed files with 139 additions and 134 deletions

View File

@ -1356,8 +1356,7 @@ bool tf_ssb_connection_is_client(tf_ssb_connection_t* connection)
bool tf_ssb_connection_is_connected(tf_ssb_connection_t* connection)
{
return (connection->state == k_tf_ssb_state_verified || connection->state == k_tf_ssb_state_server_verified) &&
!connection->is_closing;
return (connection->state == k_tf_ssb_state_verified || connection->state == k_tf_ssb_state_server_verified) && !connection->is_closing;
}
bool tf_ssb_connection_is_closing(tf_ssb_connection_t* connection)

View File

@ -1455,6 +1455,7 @@ tf_ssb_following_t* tf_ssb_db_following_deep(tf_ssb_t* ssb, const char** ids, in
result[write_index].blocking_count = following[i]->blocking_count;
result[write_index].followed_by_count = following[i]->ref_count;
result[write_index].blocked_by_count = following[i]->block_ref_count;
result[write_index].depth = following[i]->depth;
write_index++;
}
}

View File

@ -286,6 +286,8 @@ typedef struct _tf_ssb_following_t
int followed_by_count;
/** The number of known users blocking the account. */
int blocked_by_count;
/** Degree of separation between initial accounts and this account. */
int depth;
/** The account's identity. */
char id[k_id_base64_len];
} tf_ssb_following_t;

View File

@ -2187,6 +2187,7 @@ static void _tf_ssb_following_after_work(tf_ssb_t* ssb, int status, void* user_d
JS_SetPropertyStr(context, entry, "ob", JS_NewInt32(context, following->out_following[i].blocking_count));
JS_SetPropertyStr(context, entry, "if", JS_NewInt32(context, following->out_following[i].followed_by_count));
JS_SetPropertyStr(context, entry, "ib", JS_NewInt32(context, following->out_following[i].blocked_by_count));
JS_SetPropertyStr(context, entry, "d", JS_NewInt32(context, following->out_following[i].depth));
JS_SetPropertyStr(context, object, following->out_following[i].id, entry);
}
JSValue result = JS_Call(context, following->promise[0], JS_UNDEFINED, 1, &object);

View File

@ -446,8 +446,7 @@ static void _tf_ssb_rpc_send_endpoints(tf_ssb_t* ssb)
for (int i = 0; i < count; i++)
{
char id[k_id_base64_len] = { 0 };
if ((tf_ssb_connection_is_attendant(connections[i]) || tf_ssb_connection_is_endpoint(connections[i])) &&
tf_ssb_connection_is_connected(connections[i]) &&
if ((tf_ssb_connection_is_attendant(connections[i]) || tf_ssb_connection_is_endpoint(connections[i])) && tf_ssb_connection_is_connected(connections[i]) &&
tf_ssb_connection_get_id(connections[i], id, sizeof(id)))
{
JS_SetPropertyUint32(context, endpoints, id_count++, JS_NewString(context, id));