ssb: Respect blocks when getting blocks and accounts at the db level.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 8m59s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 8m59s
This commit is contained in:
@@ -221,14 +221,6 @@ static void _ebt_add_to_clock(ebt_get_clock_t* work, const char* id, int64_t val
|
||||
}
|
||||
}
|
||||
|
||||
static bool _is_blocked(tf_ssb_t* ssb, const char* id)
|
||||
{
|
||||
sqlite3* db = tf_ssb_acquire_db_reader(ssb);
|
||||
bool blocked = tf_ssb_db_is_blocked(db, id);
|
||||
tf_ssb_release_db_reader(ssb, db);
|
||||
return blocked;
|
||||
}
|
||||
|
||||
static void _tf_ssb_ebt_get_send_clock_work(tf_ssb_connection_t* connection, void* user_data)
|
||||
{
|
||||
ebt_get_clock_t* work = user_data;
|
||||
@@ -247,10 +239,7 @@ static void _tf_ssb_ebt_get_send_clock_work(tf_ssb_connection_t* connection, voi
|
||||
for (int i = 0; visible[i]; i++)
|
||||
{
|
||||
int32_t sequence = 0;
|
||||
if (!_is_blocked(ssb, visible[i]))
|
||||
{
|
||||
tf_ssb_db_get_latest_message_by_author(ssb, visible[i], &sequence, NULL, 0);
|
||||
}
|
||||
tf_ssb_db_get_latest_message_by_author(ssb, visible[i], &sequence, NULL, 0);
|
||||
sequences = tf_resize_vec(sequences, (i + 1) * sizeof(int32_t));
|
||||
sequences[i] = sequence;
|
||||
}
|
||||
@@ -270,14 +259,11 @@ static void _tf_ssb_ebt_get_send_clock_work(tf_ssb_connection_t* connection, voi
|
||||
char id[k_id_base64_len] = "";
|
||||
if (tf_ssb_connection_get_id(connection, id, sizeof(id)))
|
||||
{
|
||||
if (!_is_blocked(ssb, id))
|
||||
{
|
||||
int32_t sequence = 0;
|
||||
tf_ssb_db_get_latest_message_by_author(ssb, id, &sequence, NULL, 0);
|
||||
uv_mutex_lock(&work->ebt->mutex);
|
||||
_ebt_add_to_clock(work, id, sequence, true, true);
|
||||
uv_mutex_unlock(&work->ebt->mutex);
|
||||
}
|
||||
int32_t sequence = 0;
|
||||
tf_ssb_db_get_latest_message_by_author(ssb, id, &sequence, NULL, 0);
|
||||
uv_mutex_lock(&work->ebt->mutex);
|
||||
_ebt_add_to_clock(work, id, sequence, true, true);
|
||||
uv_mutex_unlock(&work->ebt->mutex);
|
||||
}
|
||||
|
||||
/* Also respond with what we know about all requested identities. */
|
||||
@@ -301,10 +287,7 @@ static void _tf_ssb_ebt_get_send_clock_work(tf_ssb_connection_t* connection, voi
|
||||
{
|
||||
for (int i = 0; i < requested_count; i++)
|
||||
{
|
||||
if (!_is_blocked(ssb, requested[i].id))
|
||||
{
|
||||
tf_ssb_db_get_latest_message_by_author(ssb, requested[i].id, &requested[i].value, NULL, 0);
|
||||
}
|
||||
tf_ssb_db_get_latest_message_by_author(ssb, requested[i].id, &requested[i].value, NULL, 0);
|
||||
}
|
||||
|
||||
uv_mutex_lock(&work->ebt->mutex);
|
||||
|
||||
Reference in New Issue
Block a user