Not applying draft if can't write a message. Closed beta 9049005.

This commit is contained in:
John Preston 2016-06-10 18:34:35 +03:00
parent b20245c8c8
commit 16bea47979
6 changed files with 20 additions and 12 deletions

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,49,4 FILEVERSION 0,9,49,5
PRODUCTVERSION 0,9,49,4 PRODUCTVERSION 0,9,49,5
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.9.49.4" VALUE "FileVersion", "0.9.49.5"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.49.4" VALUE "ProductVersion", "0.9.49.5"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,49,4 FILEVERSION 0,9,49,5
PRODUCTVERSION 0,9,49,4 PRODUCTVERSION 0,9,49,5
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Updater" VALUE "FileDescription", "Telegram Updater"
VALUE "FileVersion", "0.9.49.4" VALUE "FileVersion", "0.9.49.5"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.49.4" VALUE "ProductVersion", "0.9.49.5"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "core/basic_types.h" #include "core/basic_types.h"
#define BETA_VERSION_MACRO (9049004ULL) #define BETA_VERSION_MACRO (9049005ULL)
constexpr int AppVersion = 9049; constexpr int AppVersion = 9049;
constexpr str_const AppVersionStr = "0.9.49"; constexpr str_const AppVersionStr = "0.9.49";

View File

@ -3821,7 +3821,7 @@ void HistoryWidget::fastShowAtEnd(History *h) {
void HistoryWidget::applyDraft(bool parseLinks) { void HistoryWidget::applyDraft(bool parseLinks) {
auto draft = _history ? _history->draft() : nullptr; auto draft = _history ? _history->draft() : nullptr;
if (!draft) { if (!draft || !canWriteMessage()) {
clearFieldText(); clearFieldText();
_field.setFocus(); _field.setFocus();
_replyEditMsg = nullptr; _replyEditMsg = nullptr;
@ -4218,6 +4218,13 @@ bool HistoryWidget::reportSpamSettingFail(const RPCError &error, mtpRequestId re
return true; return true;
} }
bool HistoryWidget::canWriteMessage() const {
if (!_history || _a_show.animating()) return false;
if (isBlocked() || isJoinChannel() || isMuteUnmute() || isBotStart()) return false;
if (!_canSendMessages) return false;
return true;
}
void HistoryWidget::updateControlsVisibility() { void HistoryWidget::updateControlsVisibility() {
if (!_a_show.animating()) { if (!_a_show.animating()) {
_topShadow.setVisible(_peer ? true : false); _topShadow.setVisible(_peer ? true : false);
@ -5564,7 +5571,7 @@ bool HistoryWidget::botCallbackFail(BotCallbackInfo info, const RPCError &error,
} }
bool HistoryWidget::insertBotCommand(const QString &cmd, bool specialGif) { bool HistoryWidget::insertBotCommand(const QString &cmd, bool specialGif) {
if (!_history || !_canSendMessages) return false; if (!_history || !canWriteMessage()) return false;
bool insertingInlineBot = !cmd.isEmpty() && (cmd.at(0) == '@'); bool insertingInlineBot = !cmd.isEmpty() && (cmd.at(0) == '@');
QString toInsert = cmd; QString toInsert = cmd;

View File

@ -858,6 +858,7 @@ private:
void updateFieldSize(); void updateFieldSize();
bool historyHasNotFreezedUnreadBar(History *history) const; bool historyHasNotFreezedUnreadBar(History *history) const;
bool canWriteMessage() const;
void clearInlineBot(); void clearInlineBot();
void inlineBotChanged(); void inlineBotChanged();

View File

@ -3,4 +3,4 @@ AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.49 AppVersionStrSmall 0.9.49
AppVersionStr 0.9.49 AppVersionStr 0.9.49
AlphaChannel 0 AlphaChannel 0
BetaVersion 9049004 BetaVersion 9049005