mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Explicitly reload data in delegates, if related events got loaded
This commit is contained in:
parent
6d169cea7d
commit
88ed0fade7
7 changed files with 38 additions and 24 deletions
|
@ -341,6 +341,7 @@ ScrollView {
|
||||||
required property var timestamp
|
required property var timestamp
|
||||||
required property int status
|
required property int status
|
||||||
required property int index
|
required property int index
|
||||||
|
required property int relatedEventCacheBuster
|
||||||
required property string previousMessageUserId
|
required property string previousMessageUserId
|
||||||
required property string day
|
required property string day
|
||||||
required property string previousMessageDay
|
required property string previousMessageDay
|
||||||
|
@ -446,6 +447,7 @@ ScrollView {
|
||||||
trustlevel: wrapper.trustlevel
|
trustlevel: wrapper.trustlevel
|
||||||
timestamp: wrapper.timestamp
|
timestamp: wrapper.timestamp
|
||||||
status: wrapper.status
|
status: wrapper.status
|
||||||
|
relatedEventCacheBuster: wrapper.relatedEventCacheBuster
|
||||||
y: section.visible && section.active ? section.y + section.height : 0
|
y: section.visible && section.active ? section.y + section.height : 0
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
|
|
|
@ -40,6 +40,7 @@ Item {
|
||||||
required property int trustlevel
|
required property int trustlevel
|
||||||
required property var timestamp
|
required property var timestamp
|
||||||
required property int status
|
required property int status
|
||||||
|
required property int relatedEventCacheBuster
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
@ -90,25 +91,26 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: replyTo
|
visible: replyTo
|
||||||
userColor: replyTo, TimelineManager.userColor(userId, Nheko.colors.base)
|
userColor: r.relatedEventCacheBuster, TimelineManager.userColor(userId, Nheko.colors.base)
|
||||||
blurhash: replyTo, fromModel(Room.Blurhash) ?? ""
|
blurhash: r.relatedEventCacheBuster, fromModel(Room.Blurhash) ?? ""
|
||||||
body: replyTo, fromModel(Room.Body) ?? ""
|
body: r.relatedEventCacheBuster, fromModel(Room.Body) ?? ""
|
||||||
formattedBody: replyTo, fromModel(Room.FormattedBody) ?? ""
|
formattedBody: r.relatedEventCacheBuster, fromModel(Room.FormattedBody) ?? ""
|
||||||
eventId: fromModel(Room.EventId) ?? ""
|
eventId: fromModel(Room.EventId) ?? ""
|
||||||
filename: replyTo, fromModel(Room.Filename) ?? ""
|
filename: r.relatedEventCacheBuster, fromModel(Room.Filename) ?? ""
|
||||||
filesize: replyTo, fromModel(Room.Filesize) ?? ""
|
filesize: r.relatedEventCacheBuster, fromModel(Room.Filesize) ?? ""
|
||||||
proportionalHeight: replyTo, fromModel(Room.ProportionalHeight) ?? 1
|
proportionalHeight: r.relatedEventCacheBuster, fromModel(Room.ProportionalHeight) ?? 1
|
||||||
type: replyTo, fromModel(Room.Type) ?? MtxEvent.UnknownMessage
|
type: r.relatedEventCacheBuster, fromModel(Room.Type) ?? MtxEvent.UnknownMessage
|
||||||
typeString: replyTo, fromModel(Room.TypeString) ?? ""
|
typeString: r.relatedEventCacheBuster, fromModel(Room.TypeString) ?? ""
|
||||||
url: replyTo, fromModel(Room.Url) ?? ""
|
url: r.relatedEventCacheBuster, fromModel(Room.Url) ?? ""
|
||||||
originalWidth: replyTo, fromModel(Room.OriginalWidth) ?? 0
|
originalWidth: r.relatedEventCacheBuster, fromModel(Room.OriginalWidth) ?? 0
|
||||||
isOnlyEmoji: replyTo, fromModel(Room.IsOnlyEmoji) ?? false
|
isOnlyEmoji: r.relatedEventCacheBuster, fromModel(Room.IsOnlyEmoji) ?? false
|
||||||
userId: replyTo, fromModel(Room.UserId) ?? ""
|
userId: r.relatedEventCacheBuster, fromModel(Room.UserId) ?? ""
|
||||||
userName: replyTo, fromModel(Room.UserName) ?? ""
|
userName: r.relatedEventCacheBuster, fromModel(Room.UserName) ?? ""
|
||||||
thumbnailUrl: replyTo, fromModel(Room.ThumbnailUrl) ?? ""
|
thumbnailUrl: r.relatedEventCacheBuster, fromModel(Room.ThumbnailUrl) ?? ""
|
||||||
roomTopic: replyTo, fromModel(Room.RoomTopic) ?? ""
|
roomTopic: r.relatedEventCacheBuster, fromModel(Room.RoomTopic) ?? ""
|
||||||
roomName: replyTo, fromModel(Room.RoomName) ?? ""
|
roomName: r.relatedEventCacheBuster, fromModel(Room.RoomName) ?? ""
|
||||||
callType: replyTo, fromModel(Room.CallType) ?? ""
|
callType: r.relatedEventCacheBuster, fromModel(Room.CallType) ?? ""
|
||||||
|
relatedEventCacheBuster: r.relatedEventCacheBuster, fromModel(Room.RelatedEventCacheBuster) ?? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// actual message content
|
// actual message content
|
||||||
|
@ -134,6 +136,7 @@ Item {
|
||||||
roomTopic: r.roomTopic
|
roomTopic: r.roomTopic
|
||||||
roomName: r.roomName
|
roomName: r.roomName
|
||||||
callType: r.callType
|
callType: r.callType
|
||||||
|
relatedEventCacheBuster: r.relatedEventCacheBuster
|
||||||
isReply: false
|
isReply: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ Item {
|
||||||
required property string roomTopic
|
required property string roomTopic
|
||||||
required property string roomName
|
required property string roomName
|
||||||
required property string callType
|
required property string callType
|
||||||
|
required property int relatedEventCacheBuster
|
||||||
|
|
||||||
height: chooser.childrenRect.height
|
height: chooser.childrenRect.height
|
||||||
|
|
||||||
|
@ -301,7 +302,7 @@ Item {
|
||||||
body: formatted
|
body: formatted
|
||||||
isOnlyEmoji: false
|
isOnlyEmoji: false
|
||||||
isReply: d.isReply
|
isReply: d.isReply
|
||||||
formatted: room.formatPowerLevelEvent(d.eventId)
|
formatted: d.relatedEventCacheBuster, room.formatPowerLevelEvent(d.eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -313,7 +314,7 @@ Item {
|
||||||
body: formatted
|
body: formatted
|
||||||
isOnlyEmoji: false
|
isOnlyEmoji: false
|
||||||
isReply: d.isReply
|
isReply: d.isReply
|
||||||
formatted: room.formatJoinRuleEvent(d.eventId)
|
formatted: d.relatedEventCacheBuster, room.formatJoinRuleEvent(d.eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -325,7 +326,7 @@ Item {
|
||||||
body: formatted
|
body: formatted
|
||||||
isOnlyEmoji: false
|
isOnlyEmoji: false
|
||||||
isReply: d.isReply
|
isReply: d.isReply
|
||||||
formatted: room.formatHistoryVisibilityEvent(d.eventId)
|
formatted: d.relatedEventCacheBuster, room.formatHistoryVisibilityEvent(d.eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -337,7 +338,7 @@ Item {
|
||||||
body: formatted
|
body: formatted
|
||||||
isOnlyEmoji: false
|
isOnlyEmoji: false
|
||||||
isReply: d.isReply
|
isReply: d.isReply
|
||||||
formatted: room.formatGuestAccessEvent(d.eventId)
|
formatted: d.relatedEventCacheBuster, room.formatGuestAccessEvent(d.eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -349,7 +350,7 @@ Item {
|
||||||
body: formatted
|
body: formatted
|
||||||
isOnlyEmoji: false
|
isOnlyEmoji: false
|
||||||
isReply: d.isReply
|
isReply: d.isReply
|
||||||
formatted: room.formatMemberEvent(d.eventId)
|
formatted: d.relatedEventCacheBuster, room.formatMemberEvent(d.eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ Item {
|
||||||
property string roomTopic
|
property string roomTopic
|
||||||
property string roomName
|
property string roomName
|
||||||
property string callType
|
property string callType
|
||||||
|
property int relatedEventCacheBuster
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: replyContainer.height
|
height: replyContainer.height
|
||||||
|
@ -95,6 +96,7 @@ Item {
|
||||||
roomTopic: r.roomTopic
|
roomTopic: r.roomTopic
|
||||||
roomName: r.roomName
|
roomName: r.roomName
|
||||||
callType: r.callType
|
callType: r.callType
|
||||||
|
relatedEventCacheBuster: r.relatedEventCacheBuster
|
||||||
enabled: false
|
enabled: false
|
||||||
width: parent.width
|
width: parent.width
|
||||||
isReply: true
|
isReply: true
|
||||||
|
|
|
@ -122,7 +122,6 @@ Menu {
|
||||||
id: gridView
|
id: gridView
|
||||||
|
|
||||||
model: roomid ? TimelineManager.completerFor("stickers", roomid) : null
|
model: roomid ? TimelineManager.completerFor("stickers", roomid) : null
|
||||||
|
|
||||||
Layout.preferredHeight: cellHeight * 3.5
|
Layout.preferredHeight: cellHeight * 3.5
|
||||||
Layout.preferredWidth: stickersPerRow * stickerDimPad + 20
|
Layout.preferredWidth: stickersPerRow * stickerDimPad + 20
|
||||||
Layout.leftMargin: 4
|
Layout.leftMargin: 4
|
||||||
|
|
|
@ -344,6 +344,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
|
||||||
&EventStore::dataChanged,
|
&EventStore::dataChanged,
|
||||||
this,
|
this,
|
||||||
[this](int from, int to) {
|
[this](int from, int to) {
|
||||||
|
relatedEventCacheBuster++;
|
||||||
nhlog::ui()->debug(
|
nhlog::ui()->debug(
|
||||||
"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),
|
emit dataChanged(index(events.size() - to - 1, 0),
|
||||||
|
@ -443,6 +444,7 @@ TimelineModel::roleNames() const
|
||||||
{RoomTopic, "roomTopic"},
|
{RoomTopic, "roomTopic"},
|
||||||
{CallType, "callType"},
|
{CallType, "callType"},
|
||||||
{Dump, "dump"},
|
{Dump, "dump"},
|
||||||
|
{RelatedEventCacheBuster, "relatedEventCacheBuster"},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
int
|
int
|
||||||
|
@ -676,6 +678,8 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
|
||||||
|
|
||||||
return QVariant(m);
|
return QVariant(m);
|
||||||
}
|
}
|
||||||
|
case RelatedEventCacheBuster:
|
||||||
|
return relatedEventCacheBuster;
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,6 +208,7 @@ public:
|
||||||
RoomTopic,
|
RoomTopic,
|
||||||
CallType,
|
CallType,
|
||||||
Dump,
|
Dump,
|
||||||
|
RelatedEventCacheBuster,
|
||||||
};
|
};
|
||||||
Q_ENUM(Roles);
|
Q_ENUM(Roles);
|
||||||
|
|
||||||
|
@ -400,6 +401,8 @@ private:
|
||||||
|
|
||||||
int notification_count = 0, highlight_count = 0;
|
int notification_count = 0, highlight_count = 0;
|
||||||
|
|
||||||
|
unsigned int relatedEventCacheBuster = 0;
|
||||||
|
|
||||||
bool decryptDescription = true;
|
bool decryptDescription = true;
|
||||||
bool m_paginationInProgress = false;
|
bool m_paginationInProgress = false;
|
||||||
bool isSpace_ = false;
|
bool isSpace_ = false;
|
||||||
|
|
Loading…
Reference in a new issue