mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 09:41:41 -05:00
Ignore only empty drafts while sending with clear_draft (#5424)
This commit is contained in:
parent
71cf4a4885
commit
0b87db8b45
4 changed files with 10 additions and 7 deletions
|
@ -53,10 +53,10 @@ void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
|||
? TextUtilities::EntitiesFromMTP(draft.ventities.v)
|
||||
: EntitiesInText())
|
||||
};
|
||||
if (history->skipCloudDraft(textWithTags.text, draft.vdate.v)) {
|
||||
auto replyTo = draft.has_reply_to_msg_id() ? draft.vreply_to_msg_id.v : MsgId(0);
|
||||
if (history->skipCloudDraft(textWithTags.text, replyTo, draft.vdate.v)) {
|
||||
return;
|
||||
}
|
||||
auto replyTo = draft.has_reply_to_msg_id() ? draft.vreply_to_msg_id.v : MsgId(0);
|
||||
auto cloudDraft = std::make_unique<Draft>(
|
||||
textWithTags,
|
||||
replyTo,
|
||||
|
@ -80,7 +80,7 @@ void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
|||
|
||||
void clearPeerCloudDraft(PeerId peerId, TimeId date) {
|
||||
const auto history = App::history(peerId);
|
||||
if (history->skipCloudDraft(QString(), date)) {
|
||||
if (history->skipCloudDraft(QString(), MsgId(0), date)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -512,8 +512,11 @@ Data::Draft *History::createCloudDraft(const Data::Draft *fromDraft) {
|
|||
return cloudDraft();
|
||||
}
|
||||
|
||||
bool History::skipCloudDraft(const QString &text, TimeId date) const {
|
||||
if (date > 0 && date <= _lastSentDraftTime + kSkipCloudDraftsFor) {
|
||||
bool History::skipCloudDraft(const QString &text, MsgId replyTo, TimeId date) const {
|
||||
if (Data::draftStringIsEmpty(text)
|
||||
&& !replyTo
|
||||
&& date > 0
|
||||
&& date <= _lastSentDraftTime + kSkipCloudDraftsFor) {
|
||||
return true;
|
||||
} else if (_lastSentDraftText && *_lastSentDraftText == text) {
|
||||
return true;
|
||||
|
|
|
@ -326,7 +326,7 @@ public:
|
|||
void createLocalDraftFromCloud();
|
||||
void setCloudDraft(std::unique_ptr<Data::Draft> &&draft);
|
||||
Data::Draft *createCloudDraft(const Data::Draft *fromDraft);
|
||||
bool skipCloudDraft(const QString &text, TimeId date) const;
|
||||
bool skipCloudDraft(const QString &text, MsgId replyTo, TimeId date) const;
|
||||
void setSentDraftText(const QString &text);
|
||||
void clearSentDraftText(const QString &text);
|
||||
void setEditDraft(std::unique_ptr<Data::Draft> &&draft);
|
||||
|
|
2
Telegram/ThirdParty/libtgvoip
vendored
2
Telegram/ThirdParty/libtgvoip
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 78e584c443b93ce2794bee75c7448d1b00f1edc9
|
||||
Subproject commit fb0a2b0c9b59b3b19f9bc3c8a6aaf126f96d688f
|
Loading…
Add table
Reference in a new issue