mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 13:08:48 +03:00
Change decrypt setting again
This commit is contained in:
parent
18557023d9
commit
5893365439
3 changed files with 8 additions and 12 deletions
|
@ -511,20 +511,12 @@ isMessage(const mtx::events::EncryptedEvent<T> &)
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::updateLastMessage()
|
TimelineModel::updateLastMessage()
|
||||||
{
|
|
||||||
// Get the user setting to show decrypted messages in side bar
|
|
||||||
bool decrypt = QSettings().value("user/decrypt_sidebar", true).toBool();
|
|
||||||
updateLastMessage(decrypt);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TimelineModel::updateLastMessage(bool decrypt)
|
|
||||||
{
|
{
|
||||||
for (auto it = eventOrder.begin(); it != eventOrder.end(); ++it) {
|
for (auto it = eventOrder.begin(); it != eventOrder.end(); ++it) {
|
||||||
auto event = events.value(*it);
|
auto event = events.value(*it);
|
||||||
if (auto e = std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(
|
if (auto e = std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(
|
||||||
&event)) {
|
&event)) {
|
||||||
if (decrypt) {
|
if (decryptDescription) {
|
||||||
event = decryptEvent(*e).event;
|
event = decryptEvent(*e).event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ public:
|
||||||
Q_INVOKABLE void cacheMedia(QString eventId);
|
Q_INVOKABLE void cacheMedia(QString eventId);
|
||||||
Q_INVOKABLE bool saveMedia(QString eventId) const;
|
Q_INVOKABLE bool saveMedia(QString eventId) const;
|
||||||
|
|
||||||
void updateLastMessage(bool);
|
void updateLastMessage();
|
||||||
void addEvents(const mtx::responses::Timeline &events);
|
void addEvents(const mtx::responses::Timeline &events);
|
||||||
template<class T>
|
template<class T>
|
||||||
void sendMessage(const T &msg);
|
void sendMessage(const T &msg);
|
||||||
|
@ -224,6 +224,7 @@ public slots:
|
||||||
emit replyChanged(reply_);
|
emit replyChanged(reply_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void setDecryptDescription(bool decrypt) { decryptDescription = decrypt; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// Add old events at the top of the timeline.
|
// Add old events at the top of the timeline.
|
||||||
|
@ -259,7 +260,6 @@ private:
|
||||||
const mtx::responses::ClaimKeys &res,
|
const mtx::responses::ClaimKeys &res,
|
||||||
mtx::http::RequestErr err);
|
mtx::http::RequestErr err);
|
||||||
void readEvent(const std::string &id);
|
void readEvent(const std::string &id);
|
||||||
void updateLastMessage();
|
|
||||||
|
|
||||||
QHash<QString, mtx::events::collections::TimelineEvents> events;
|
QHash<QString, mtx::events::collections::TimelineEvents> events;
|
||||||
QSet<QString> read;
|
QSet<QString> read;
|
||||||
|
@ -271,6 +271,7 @@ private:
|
||||||
|
|
||||||
bool isInitialSync = true;
|
bool isInitialSync = true;
|
||||||
bool paginationInProgress = false;
|
bool paginationInProgress = false;
|
||||||
|
bool decryptDescription = true;
|
||||||
|
|
||||||
QString currentId;
|
QString currentId;
|
||||||
QString reply_;
|
QString reply_;
|
||||||
|
|
|
@ -25,7 +25,8 @@ TimelineViewManager::updateEncryptedDescriptions()
|
||||||
auto ptr = i.value();
|
auto ptr = i.value();
|
||||||
|
|
||||||
if (!ptr.isNull()) {
|
if (!ptr.isNull()) {
|
||||||
ptr->updateLastMessage(decrypt);
|
ptr->setDecryptDescription(decrypt);
|
||||||
|
ptr->updateLastMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,6 +133,8 @@ TimelineViewManager::addRoom(const QString &room_id)
|
||||||
{
|
{
|
||||||
if (!models.contains(room_id)) {
|
if (!models.contains(room_id)) {
|
||||||
QSharedPointer<TimelineModel> newRoom(new TimelineModel(this, room_id));
|
QSharedPointer<TimelineModel> newRoom(new TimelineModel(this, room_id));
|
||||||
|
newRoom->setDecryptDescription(settings->isDecryptSidebarEnabled());
|
||||||
|
|
||||||
connect(newRoom.data(),
|
connect(newRoom.data(),
|
||||||
&TimelineModel::newEncryptedImage,
|
&TimelineModel::newEncryptedImage,
|
||||||
imgProvider,
|
imgProvider,
|
||||||
|
|
Loading…
Reference in a new issue