Don't send dice / dart to channels.

Fixes #7703.
This commit is contained in:
John Preston 2020-05-01 14:35:20 +04:00
parent d8e55081b0
commit cc463b07b1
1 changed files with 18 additions and 16 deletions

View File

@ -42,22 +42,24 @@ namespace {
.durationMs = Ui::Toast::kDefaultDuration * 2,
.multiline = true,
};
auto link = Ui::Text::Link(
tr::lng_about_random_send(tr::now).toUpper());
link.entities.push_back(
EntityInText(EntityType::Bold, 0, link.text.size()));
config.text.append(' ').append(std::move(link));
config.filter = crl::guard(&history->session(), [=](
const ClickHandlerPtr &handler,
Qt::MouseButton button) {
if (button == Qt::LeftButton) {
auto message = Api::MessageToSend(history);
message.action.clearDraft = false;
message.textWithTags.text = emoji;
Api::SendDice(message);
}
return false;
});
if (history->peer->canWrite()) {
auto link = Ui::Text::Link(
tr::lng_about_random_send(tr::now).toUpper());
link.entities.push_back(
EntityInText(EntityType::Bold, 0, link.text.size()));
config.text.append(' ').append(std::move(link));
config.filter = crl::guard(&history->session(), [=](
const ClickHandlerPtr &handler,
Qt::MouseButton button) {
if (button == Qt::LeftButton) {
auto message = Api::MessageToSend(history);
message.action.clearDraft = false;
message.textWithTags.text = emoji;
Api::SendDice(message);
}
return false;
});
}
Ui::Toast::Show(config);
});
}