summary refs log tree commit diff
path: root/src/timeline/InputBar.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-12-13 00:43:05 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-12-13 00:43:05 +0100
commitdae032172d9280facec9538e38fefc3231205cc8 (patch)
treea0069d2443696e53021117a8346b843969f89448 /src/timeline/InputBar.cpp
parentVertically align message input (diff)
downloadnheko-dae032172d9280facec9538e38fefc3231205cc8.tar.xz
Add recently used reactions
fixes #435
Diffstat (limited to 'src/timeline/InputBar.cpp')
-rw-r--r--src/timeline/InputBar.cpp8
1 files changed, 8 insertions, 0 deletions
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);