Allow to use Premium custom emoji from group emoji set in supergroups.

This commit is contained in:
levlam 2024-02-08 15:09:26 +03:00
parent 42784587ad
commit 0dad023262
3 changed files with 7 additions and 3 deletions

View File

@ -5429,10 +5429,13 @@ FolderId ContactsManager::get_secret_chat_initial_folder_id(SecretChatId secret_
return c->initial_folder_id;
}
bool ContactsManager::can_use_premium_custom_emoji() const {
bool ContactsManager::can_use_premium_custom_emoji(DialogId dialog_id) const {
if (td_->option_manager_->get_option_boolean("is_premium")) {
return true;
}
if (dialog_id.get_type() == DialogType::Channel && is_megagroup_channel(dialog_id.get_channel_id())) {
return true;
}
if (!td_->auth_manager_->is_bot()) {
return false;
}

View File

@ -316,7 +316,7 @@ class ContactsManager final : public Actor {
void unregister_message_channels(MessageFullId message_full_id, vector<ChannelId> channel_ids);
bool can_use_premium_custom_emoji() const;
bool can_use_premium_custom_emoji(DialogId dialog_id) const;
UserId get_my_id() const;

View File

@ -4731,7 +4731,8 @@ void remove_unallowed_entities(const Td *td, FormattedText &text, DialogId dialo
remove_intersecting_entities(text.entities);
}
}
if (dialog_id != td->dialog_manager_->get_my_dialog_id() && !td->contacts_manager_->can_use_premium_custom_emoji()) {
if (dialog_id != td->dialog_manager_->get_my_dialog_id() &&
!td->contacts_manager_->can_use_premium_custom_emoji(dialog_id)) {
remove_premium_custom_emoji_entities(td, text.entities, false);
}
}