Foldable State Events
Implement folding sections for multiple consecutive state events. This also reworks some of the aggregated text output: - Only new days cause a new section - The aggregated text starts with either a single username or n users - If the same user did the same action mutltiple times it will be in the aggregated text a user did x n times - When there are multiple authors in a block with multiple state event types it will use or rather than and before the last event. e.g 3 user left the room or joined the room. Folded  Unfolded  Implements network/neochat#90
This commit is contained in:
@@ -67,6 +67,7 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const
|
||||
roles[IsNameChangeRole] = "isNameChange";
|
||||
roles[IsAvatarChangeRole] = "isAvatarChange";
|
||||
roles[IsRedactedRole] = "isRedacted";
|
||||
roles[GenericDisplayRole] = "genericDisplay";
|
||||
return roles;
|
||||
}
|
||||
|
||||
@@ -462,6 +463,14 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
return m_currentRoom->eventToString(evt, Qt::RichText);
|
||||
}
|
||||
|
||||
if (role == GenericDisplayRole) {
|
||||
if (evt.isRedacted()) {
|
||||
return i18n("<i>[This message was deleted]</i>");
|
||||
}
|
||||
|
||||
return m_currentRoom->eventToGenericString(evt);
|
||||
}
|
||||
|
||||
if (role == FormattedBodyRole) {
|
||||
if (auto e = eventCast<const RoomMessageEvent>(&evt)) {
|
||||
if (e->hasTextContent() && e->mimeType().name() != "text/plain") {
|
||||
|
||||
Reference in New Issue
Block a user