Don't remove emoji modifiers in chat action emojis.
This commit is contained in:
parent
a18c263fa3
commit
fbd2309b37
@ -21,11 +21,7 @@ bool DialogAction::is_valid_emoji(string &emoji) {
|
||||
if (!clean_input_string(emoji)) {
|
||||
return false;
|
||||
}
|
||||
remove_emoji_modifiers_in_place(emoji);
|
||||
if (emoji.empty()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return is_emoji(emoji);
|
||||
}
|
||||
|
||||
void DialogAction::init(Type type) {
|
||||
|
@ -5314,11 +5314,12 @@ void get_message_content_animated_emoji_click_sticker(const MessageContent *cont
|
||||
}
|
||||
|
||||
void on_message_content_animated_emoji_clicked(const MessageContent *content, FullMessageId full_message_id, Td *td,
|
||||
string emoji, string data) {
|
||||
Slice emoji, string data) {
|
||||
if (content->get_type() != MessageContentType::Text) {
|
||||
return;
|
||||
}
|
||||
|
||||
emoji = remove_emoji_modifiers(emoji);
|
||||
auto &text = static_cast<const MessageText *>(content)->text;
|
||||
if (!text.entities.empty() || remove_emoji_modifiers(text.text) != emoji) {
|
||||
return;
|
||||
@ -5559,9 +5560,10 @@ StickerSetId add_sticker_set(Td *td, tl_object_ptr<telegram_api::InputStickerSet
|
||||
bool is_unsent_animated_emoji_click(Td *td, DialogId dialog_id, const DialogAction &action) {
|
||||
auto emoji = action.get_watching_animations_emoji();
|
||||
if (emoji.empty()) {
|
||||
// not a WatchingAnimations action
|
||||
return false;
|
||||
}
|
||||
return !td->stickers_manager_->is_sent_animated_emoji_click(dialog_id, emoji);
|
||||
return !td->stickers_manager_->is_sent_animated_emoji_click(dialog_id, remove_emoji_modifiers(emoji));
|
||||
}
|
||||
|
||||
void on_dialog_used(TopDialogCategory category, DialogId dialog_id, int32 date) {
|
||||
|
@ -230,7 +230,7 @@ void get_message_content_animated_emoji_click_sticker(const MessageContent *cont
|
||||
Td *td, Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
||||
|
||||
void on_message_content_animated_emoji_clicked(const MessageContent *content, FullMessageId full_message_id, Td *td,
|
||||
string emoji, string data);
|
||||
Slice emoji, string data);
|
||||
|
||||
bool need_reget_message_content(const MessageContent *content);
|
||||
|
||||
|
@ -7106,7 +7106,7 @@ void MessagesManager::on_user_dialog_action(DialogId dialog_id, MessageId top_th
|
||||
auto message_id = MessageId(ServerMessageId(clicking_info.message_id));
|
||||
CHECK(message_id.is_valid());
|
||||
if (date > G()->unix_time() - 10) {
|
||||
on_animated_emoji_message_clicked({dialog_id, message_id}, user_id, std::move(clicking_info.emoji),
|
||||
on_animated_emoji_message_clicked({dialog_id, message_id}, user_id, clicking_info.emoji,
|
||||
std::move(clicking_info.data));
|
||||
}
|
||||
return;
|
||||
@ -19748,7 +19748,7 @@ void MessagesManager::click_animated_emoji_message(FullMessageId full_message_id
|
||||
get_message_content_animated_emoji_click_sticker(m->content.get(), full_message_id, td_, std::move(promise));
|
||||
}
|
||||
|
||||
void MessagesManager::on_animated_emoji_message_clicked(FullMessageId full_message_id, UserId user_id, string emoji,
|
||||
void MessagesManager::on_animated_emoji_message_clicked(FullMessageId full_message_id, UserId user_id, Slice emoji,
|
||||
string data) {
|
||||
CHECK(full_message_id.get_message_id().is_server());
|
||||
auto *m = get_message_force(full_message_id, "on_animated_emoji_message_clicked");
|
||||
@ -19759,7 +19759,7 @@ void MessagesManager::on_animated_emoji_message_clicked(FullMessageId full_messa
|
||||
full_message_id.get_dialog_id().get_user_id() != user_id) {
|
||||
return;
|
||||
}
|
||||
on_message_content_animated_emoji_clicked(m->content.get(), full_message_id, td_, std::move(emoji), std::move(data));
|
||||
on_message_content_animated_emoji_clicked(m->content.get(), full_message_id, td_, emoji, std::move(data));
|
||||
}
|
||||
|
||||
void MessagesManager::open_dialog(Dialog *d) {
|
||||
|
@ -2964,7 +2964,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
Status can_import_messages(DialogId dialog_id);
|
||||
|
||||
void on_animated_emoji_message_clicked(FullMessageId full_message_id, UserId user_id, string emoji, string data);
|
||||
void on_animated_emoji_message_clicked(FullMessageId full_message_id, UserId user_id, Slice emoji, string data);
|
||||
|
||||
void add_sponsored_dialog(const Dialog *d, DialogSource source);
|
||||
|
||||
|
@ -4241,7 +4241,7 @@ void StickersManager::flush_sent_animated_emoji_clicks() {
|
||||
sent_animated_emoji_clicks_.erase(sent_animated_emoji_clicks_.begin(), it);
|
||||
}
|
||||
|
||||
bool StickersManager::is_sent_animated_emoji_click(DialogId dialog_id, const string &emoji) {
|
||||
bool StickersManager::is_sent_animated_emoji_click(DialogId dialog_id, Slice emoji) {
|
||||
flush_sent_animated_emoji_clicks();
|
||||
for (const auto &click : sent_animated_emoji_clicks_) {
|
||||
if (click.dialog_id == dialog_id && click.emoji == emoji) {
|
||||
@ -4251,8 +4251,7 @@ bool StickersManager::is_sent_animated_emoji_click(DialogId dialog_id, const str
|
||||
return false;
|
||||
}
|
||||
|
||||
Status StickersManager::on_animated_emoji_message_clicked(const string &emoji, FullMessageId full_message_id,
|
||||
string data) {
|
||||
Status StickersManager::on_animated_emoji_message_clicked(Slice emoji, FullMessageId full_message_id, string data) {
|
||||
TRY_RESULT(value, json_decode(data));
|
||||
if (value.type() != JsonValue::Type::Object) {
|
||||
return Status::Error("Expected an object");
|
||||
@ -4313,7 +4312,7 @@ Status StickersManager::on_animated_emoji_message_clicked(const string &emoji, F
|
||||
}
|
||||
|
||||
PendingOnAnimatedEmojiClicked pending_request;
|
||||
pending_request.emoji_ = emoji;
|
||||
pending_request.emoji_ = emoji.str();
|
||||
pending_request.full_message_id_ = full_message_id;
|
||||
pending_request.clicks_ = std::move(clicks);
|
||||
pending_on_animated_emoji_message_clicked_.push_back(std::move(pending_request));
|
||||
|
@ -73,9 +73,9 @@ class StickersManager final : public Actor {
|
||||
|
||||
void on_send_animated_emoji_clicks(DialogId dialog_id, const string &emoji);
|
||||
|
||||
bool is_sent_animated_emoji_click(DialogId dialog_id, const string &emoji);
|
||||
bool is_sent_animated_emoji_click(DialogId dialog_id, Slice emoji);
|
||||
|
||||
Status on_animated_emoji_message_clicked(const string &emoji, FullMessageId full_message_id, string data);
|
||||
Status on_animated_emoji_message_clicked(Slice emoji, FullMessageId full_message_id, string data);
|
||||
|
||||
void create_sticker(FileId file_id, string minithumbnail, PhotoSize thumbnail, Dimensions dimensions,
|
||||
tl_object_ptr<telegram_api::documentAttributeSticker> sticker, bool is_animated,
|
||||
|
Loading…
Reference in New Issue
Block a user