Expose read-only channel membership for invitation UI

This commit is contained in:
evgeny committed 2026-10-04 14:59:07 +02:00
1 parent fb21f9c1af
commit 55d9e79983
2 files changed
+12

No files matched your search

+11
View File
@@ -144,6 +144,17 @@ QList<ChannelRow> DbManager::getChannels(ChannelSortMode sort) const {
return list;
}
bool DbManager::isChannelMember(const QString& chId, quint64 nodeId) const {
const QByteArray sql = QStringLiteral("SELECT 1 FROM \"%1\" WHERE node_id=?").arg(peersTableName(chId)).toUtf8();
sqlite3_stmt* statement = prepareOrNull(sql.constData());
if (!statement) return false;
sqlite3_bind_int64(statement, 1, (sqlite3_int64)nodeId);
const int result = sqlite3_step(statement);
if (result != SQLITE_ROW && result != SQLITE_DONE) GUI_ERROR("channel membership read failed ch=%s rc=%d", qPrintable(chId), result);
sqlite3_finalize(statement);
return result == SQLITE_ROW;
}
/* Формирует человекочитаемое тело превью последнего сообщения по content_type и "d"-полю. */
static QString mediaPreviewBody(const QString& ct, const QByteArray& d) {
bool isText = ct.isEmpty() || ct == QStringLiteral("text/plain") ||