From dae032172d9280facec9538e38fefc3231205cc8 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 13 Dec 2021 00:43:05 +0100 Subject: Add recently used reactions fixes #435 --- src/timeline/InputBar.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/timeline/InputBar.cpp') diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp index 78416135..191160ea 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp @@ -829,6 +829,14 @@ InputBar::reaction(const QString &reactedEvent, const QString &reactionKey) reaction.relations.relations.push_back(rel); room->sendMessageEvent(reaction, mtx::events::EventType::Reaction); + + auto recents = UserSettings::instance()->recentReactions(); + if (recents.contains(reactionKey)) + recents.removeOne(reactionKey); + else if (recents.size() >= 6) + recents.removeLast(); + recents.push_front(reactionKey); + UserSettings::instance()->setRecentReactions(recents); // Otherwise, we have previously reacted and the reaction should be redacted } else { room->redactEvent(selfReactedEvent); -- cgit 1.5.1