Refactor lastEventIsSpoiler, remove lastEvent() call that isn't needed

This is only called after we already get an event with lastEvent() so
doing it again is useless. Instead, we should refactor it to behave like
similar functions (e.g. isEventHighlighted.)
This commit is contained in:
Joshua Goins
2025-04-27 15:52:44 -04:00
committed by Tobias Fella
parent 8817ca7f2b
commit 08dc05c707
4 changed files with 9 additions and 11 deletions

View File

@@ -248,7 +248,7 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
}
if (role == SubtitleTextRole) {
const auto lastEvent = room->lastEvent(m_hiddenFilter);
if (lastEvent == nullptr || room->lastEventIsSpoiler()) {
if (lastEvent == nullptr || room->isEventSpoiler(lastEvent)) {
return QString();
}
return EventHandler::subtitleText(room, lastEvent);