Fix spoilers in roomlist subtitles
Make sure spoilers aren't revealed in SubtitleRole like in LastEventRole then remove LastEventRole because it is no longer used
This commit is contained in:
@@ -174,10 +174,10 @@ void RoomListModel::connectRoomSignals(NeoChatRoom *room)
|
|||||||
refresh(room);
|
refresh(room);
|
||||||
});
|
});
|
||||||
connect(room, &Room::addedMessages, this, [this, room] {
|
connect(room, &Room::addedMessages, this, [this, room] {
|
||||||
refresh(room, {LastEventRole, SubtitleTextRole, LastActiveTimeRole});
|
refresh(room, {SubtitleTextRole, LastActiveTimeRole});
|
||||||
});
|
});
|
||||||
connect(room, &Room::pendingEventMerged, this, [this, room] {
|
connect(room, &Room::pendingEventMerged, this, [this, room] {
|
||||||
refresh(room, {LastEventRole, SubtitleTextRole});
|
refresh(room, {SubtitleTextRole});
|
||||||
});
|
});
|
||||||
connect(room, &Room::unreadStatsChanged, this, &RoomListModel::refreshNotificationCount);
|
connect(room, &Room::unreadStatsChanged, this, &RoomListModel::refreshNotificationCount);
|
||||||
connect(room, &Room::highlightCountChanged, this, &RoomListModel::refreshHighlightCount);
|
connect(room, &Room::highlightCountChanged, this, &RoomListModel::refreshHighlightCount);
|
||||||
@@ -332,12 +332,6 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
|||||||
if (role == HighlightCountRole) {
|
if (role == HighlightCountRole) {
|
||||||
return room->highlightCount();
|
return room->highlightCount();
|
||||||
}
|
}
|
||||||
if (role == LastEventRole) {
|
|
||||||
if (room->lastEventIsSpoiler()) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
return room->lastEventToString();
|
|
||||||
}
|
|
||||||
if (role == LastActiveTimeRole) {
|
if (role == LastActiveTimeRole) {
|
||||||
return room->lastActiveTime();
|
return room->lastActiveTime();
|
||||||
}
|
}
|
||||||
@@ -354,6 +348,9 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
|||||||
return m_categoryVisibility.value(data(index, CategoryRole).toInt(), true);
|
return m_categoryVisibility.value(data(index, CategoryRole).toInt(), true);
|
||||||
}
|
}
|
||||||
if (role == SubtitleTextRole) {
|
if (role == SubtitleTextRole) {
|
||||||
|
if (room->lastEventIsSpoiler()) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
return room->lastEventToString(Qt::PlainText, true);
|
return room->lastEventToString(Qt::PlainText, true);
|
||||||
}
|
}
|
||||||
if (role == AvatarImageRole) {
|
if (role == AvatarImageRole) {
|
||||||
@@ -396,7 +393,6 @@ QHash<int, QByteArray> RoomListModel::roleNames() const
|
|||||||
roles[CategoryRole] = "category";
|
roles[CategoryRole] = "category";
|
||||||
roles[NotificationCountRole] = "notificationCount";
|
roles[NotificationCountRole] = "notificationCount";
|
||||||
roles[HighlightCountRole] = "highlightCount";
|
roles[HighlightCountRole] = "highlightCount";
|
||||||
roles[LastEventRole] = "lastEvent";
|
|
||||||
roles[LastActiveTimeRole] = "lastActiveTime";
|
roles[LastActiveTimeRole] = "lastActiveTime";
|
||||||
roles[JoinStateRole] = "joinState";
|
roles[JoinStateRole] = "joinState";
|
||||||
roles[CurrentRoomRole] = "currentRoom";
|
roles[CurrentRoomRole] = "currentRoom";
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ public:
|
|||||||
CategoryRole, /**< The room category, e.g favourite. */
|
CategoryRole, /**< The room category, e.g favourite. */
|
||||||
NotificationCountRole, /**< The number of notifications in the room. */
|
NotificationCountRole, /**< The number of notifications in the room. */
|
||||||
HighlightCountRole, /**< The number of highlighted messages in the room. */
|
HighlightCountRole, /**< The number of highlighted messages in the room. */
|
||||||
LastEventRole, /**< Text for the last event in the room. */
|
|
||||||
LastActiveTimeRole, /**< The timestamp of the last event sent in the room. */
|
LastActiveTimeRole, /**< The timestamp of the last event sent in the room. */
|
||||||
JoinStateRole, /**< The local user's join state in the room. */
|
JoinStateRole, /**< The local user's join state in the room. */
|
||||||
CurrentRoomRole, /**< The room object for the room. */
|
CurrentRoomRole, /**< The room object for the room. */
|
||||||
|
|||||||
Reference in New Issue
Block a user