mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 12:38:48 +03:00
Fix pins not refreshing after being loaded
This commit is contained in:
parent
bcc6c518be
commit
3eafd4396e
4 changed files with 15 additions and 4 deletions
|
@ -271,7 +271,12 @@ Pane {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
|
|
||||||
Reply {
|
Reply {
|
||||||
property var e: room ? room.getDump(modelData, "") : {}
|
id: reply
|
||||||
|
property var e: room ? room.getDump(modelData, "pins") : {}
|
||||||
|
Connections {
|
||||||
|
function onPinnedMessagesChanged() { reply.e = room.getDump(modelData, "pins") }
|
||||||
|
target: room
|
||||||
|
}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: height
|
Layout.preferredHeight: height
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,14 @@ EventStore::EventStore(std::string room_id, QObject *)
|
||||||
cache::client()->storeEvent(room_id_, id, {timeline});
|
cache::client()->storeEvent(room_id_, id, {timeline});
|
||||||
|
|
||||||
if (!relatedTo.empty()) {
|
if (!relatedTo.empty()) {
|
||||||
|
if (relatedTo == "pins") {
|
||||||
|
emit pinsChanged();
|
||||||
|
} else {
|
||||||
auto idx = idToIndex(relatedTo);
|
auto idx = idToIndex(relatedTo);
|
||||||
if (idx)
|
if (idx)
|
||||||
emit dataChanged(*idx, *idx);
|
emit dataChanged(*idx, *idx);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ signals:
|
||||||
void beginResetModel();
|
void beginResetModel();
|
||||||
void endResetModel();
|
void endResetModel();
|
||||||
void dataChanged(int from, int to);
|
void dataChanged(int from, int to);
|
||||||
|
void pinsChanged();
|
||||||
void newEncryptedImage(mtx::crypto::EncryptedFile encryptionInfo);
|
void newEncryptedImage(mtx::crypto::EncryptedFile encryptionInfo);
|
||||||
void eventFetched(std::string id,
|
void eventFetched(std::string id,
|
||||||
std::string relatedTo,
|
std::string relatedTo,
|
||||||
|
|
|
@ -398,6 +398,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
|
||||||
"data changed {} to {}", events.size() - to - 1, events.size() - from - 1);
|
"data changed {} to {}", events.size() - to - 1, events.size() - from - 1);
|
||||||
emit dataChanged(index(events.size() - to - 1, 0), index(events.size() - from - 1, 0));
|
emit dataChanged(index(events.size() - to - 1, 0), index(events.size() - from - 1, 0));
|
||||||
});
|
});
|
||||||
|
connect(&events, &EventStore::pinsChanged, this, &TimelineModel::pinnedMessagesChanged);
|
||||||
|
|
||||||
connect(&events, &EventStore::beginInsertRows, this, [this](int from, int to) {
|
connect(&events, &EventStore::beginInsertRows, this, [this](int from, int to) {
|
||||||
int first = events.size() - to;
|
int first = events.size() - to;
|
||||||
|
|
Loading…
Reference in a new issue