mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
feat: clear start token on right click
This commit is contained in:
parent
b15402dc72
commit
1e986f85d9
1 changed files with 16 additions and 2 deletions
|
@ -353,7 +353,20 @@ HistoryWidget::HistoryWidget(
|
||||||
sendAction);
|
sendAction);
|
||||||
}
|
}
|
||||||
_unblock->addClickHandler([=] { unblockUser(); });
|
_unblock->addClickHandler([=] { unblockUser(); });
|
||||||
_botStart->addClickHandler([=] { sendBotStartCommand(); });
|
_botStart->setAcceptBoth(true);
|
||||||
|
_botStart->clicks() | rpl::start_with_next(
|
||||||
|
[=](Qt::MouseButton button)
|
||||||
|
{
|
||||||
|
if (button == Qt::LeftButton) {
|
||||||
|
sendBotStartCommand();
|
||||||
|
} else if (button == Qt::RightButton && isBotStart() && !_peer->asUser()->botInfo->startToken.isEmpty()) {
|
||||||
|
_peer->asUser()->botInfo->startToken = QString();
|
||||||
|
session().changes().peerUpdated(
|
||||||
|
_peer,
|
||||||
|
Data::PeerUpdate::Flag::BotStartToken);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_botStart->lifetime());
|
||||||
_joinChannel->addClickHandler([=] { joinChannel(); });
|
_joinChannel->addClickHandler([=] { joinChannel(); });
|
||||||
_muteUnmute->addClickHandler([=] { toggleMuteUnmute(); });
|
_muteUnmute->addClickHandler([=] { toggleMuteUnmute(); });
|
||||||
_discuss->addClickHandler([=] { goToDiscussionGroup(); });
|
_discuss->addClickHandler([=] { goToDiscussionGroup(); });
|
||||||
|
@ -3027,7 +3040,8 @@ void HistoryWidget::updateControlsVisibility() {
|
||||||
|
|
||||||
const auto startToken = _peer->asUser()->botInfo->startToken;
|
const auto startToken = _peer->asUser()->botInfo->startToken;
|
||||||
if (!startToken.isEmpty()) {
|
if (!startToken.isEmpty()) {
|
||||||
const auto s = QString("%1 (%2)").arg(tr::lng_bot_start(tr::now).toUpper()).arg(startToken);
|
const auto shortened = startToken.left(20);
|
||||||
|
const auto s = QString("%1 (%2)").arg(tr::lng_bot_start(tr::now).toUpper()).arg(shortened);
|
||||||
_botStart->setText(s);
|
_botStart->setText(s);
|
||||||
} else {
|
} else {
|
||||||
_botStart->setText(tr::lng_bot_start(tr::now).toUpper());
|
_botStart->setText(tr::lng_bot_start(tr::now).toUpper());
|
||||||
|
|
Loading…
Add table
Reference in a new issue