2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Implement custom reactions in stories.

This commit is contained in:
John Preston
2023-08-08 10:55:12 +02:00
parent 066dbfe8fc
commit 13f67d68c4
21 changed files with 744 additions and 192 deletions

View File

@@ -870,6 +870,21 @@ void Stories::activateStealthMode(Fn<void()> done) {
}).send();
}
void Stories::sendReaction(FullStoryId id, Data::ReactionId reaction) {
if (const auto maybeStory = lookup(id)) {
const auto story = *maybeStory;
story->setReactionId(reaction);
const auto api = &session().api();
api->request(MTPstories_SendReaction(
MTP_flags(0),
story->peer()->asUser()->inputUser,
MTP_int(id.story),
ReactionToMTP(reaction)
)).send();
}
}
std::shared_ptr<HistoryItem> Stories::resolveItem(not_null<Story*> story) {
auto &items = _items[story->peer()->id];
auto i = items.find(story->id());