Don't show sticker suggestions if can't send.

Fixes #6581.
This commit is contained in:
John Preston 2019-09-27 19:56:54 +03:00
parent e06bf16980
commit 4af9c801ae
1 changed files with 6 additions and 2 deletions

View File

@ -535,6 +535,7 @@ HistoryWidget::HistoryWidget(
if (update.peer == _peer) {
if (update.flags & UpdateFlag::RightsChanged) {
checkPreview();
updateStickersByEmoji();
}
if (update.flags & UpdateFlag::UnreadMentionsChanged) {
updateUnreadMentionsVisibility();
@ -1106,11 +1107,14 @@ void HistoryWidget::orderWidgets() {
}
void HistoryWidget::updateStickersByEmoji() {
if (!_history) {
if (!_peer) {
return;
}
const auto emoji = [&] {
if (!_editMsgId) {
const auto errorForStickers = Data::RestrictionError(
_peer,
ChatRestriction::f_send_stickers);
if (!_editMsgId && !errorForStickers) {
const auto &text = _field->getTextWithTags().text;
auto length = 0;
if (const auto emoji = Ui::Emoji::Find(text, &length)) {