Add recently used reactions

fixes #435
This commit is contained in:
Nicolas Werner 2021-12-13 00:43:05 +01:00
parent ad91784d86
commit dae032172d
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
6 changed files with 95 additions and 1 deletions

View file

@ -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);