mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-21 18:50:47 +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
|
||||
|
||||
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.preferredHeight: height
|
||||
|
||||
|
|
|
@ -48,9 +48,13 @@ EventStore::EventStore(std::string room_id, QObject *)
|
|||
cache::client()->storeEvent(room_id_, id, {timeline});
|
||||
|
||||
if (!relatedTo.empty()) {
|
||||
auto idx = idToIndex(relatedTo);
|
||||
if (idx)
|
||||
emit dataChanged(*idx, *idx);
|
||||
if (relatedTo == "pins") {
|
||||
emit pinsChanged();
|
||||
} else {
|
||||
auto idx = idToIndex(relatedTo);
|
||||
if (idx)
|
||||
emit dataChanged(*idx, *idx);
|
||||
}
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
|
|
@ -101,6 +101,7 @@ signals:
|
|||
void beginResetModel();
|
||||
void endResetModel();
|
||||
void dataChanged(int from, int to);
|
||||
void pinsChanged();
|
||||
void newEncryptedImage(mtx::crypto::EncryptedFile encryptionInfo);
|
||||
void eventFetched(std::string id,
|
||||
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);
|
||||
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) {
|
||||
int first = events.size() - to;
|
||||
|
|
Loading…
Reference in a new issue