diff --git a/src/ssb.js.c b/src/ssb.js.c index ec59fd87..8129b7f6 100644 --- a/src/ssb.js.c +++ b/src/ssb.js.c @@ -637,9 +637,9 @@ static void _tf_ssb_getIdentityInfo_visit(const char* identity, void* data) static void _tf_ssb_getIdentityInfo_work(tf_ssb_t* ssb, void* user_data) { identity_info_work_t* request = user_data; + char id[k_id_base64_len] = ""; if (tf_ssb_db_user_has_permission(ssb, request->name, "administration")) { - char id[k_id_base64_len] = ""; if (tf_ssb_whoami(ssb, id, sizeof(id))) { _tf_ssb_getIdentityInfo_visit(*id == '@' ? id + 1 : id, request); @@ -657,12 +657,15 @@ static void _tf_ssb_getIdentityInfo_work(tf_ssb_t* ssb, void* user_data) " messages.content ->> 'name' AS name " " FROM messages " " JOIN identities ON messages.author = ('@' || identities.public_key) " - " WHERE identities.user = ? AND json_extract(messages.content, '$.type') = 'about' AND content ->> 'about' = messages.author AND name IS NOT NULL) " + " WHERE " + " (identities.user = ? OR identities.public_key = ?) AND " + " json_extract(messages.content, '$.type') = 'about' AND " + " content ->> 'about' = messages.author AND name IS NOT NULL) " "WHERE author_rank = 1 ", -1, &statement, NULL); if (request->result == SQLITE_OK) { - if (sqlite3_bind_text(statement, 1, request->name, -1, NULL) == SQLITE_OK) + if (sqlite3_bind_text(statement, 1, request->name, -1, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 2, *id == '@' ? id + 1 : id, -1, NULL) == SQLITE_OK) { int r = SQLITE_OK; while ((r = sqlite3_step(statement)) == SQLITE_ROW)