mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-01 07:05:13 +00:00
Ignore only empty drafts while sending with clear_draft (#5424)
This commit is contained in:
@@ -53,10 +53,10 @@ void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
|||||||
? TextUtilities::EntitiesFromMTP(draft.ventities.v)
|
? TextUtilities::EntitiesFromMTP(draft.ventities.v)
|
||||||
: EntitiesInText())
|
: 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;
|
return;
|
||||||
}
|
}
|
||||||
auto replyTo = draft.has_reply_to_msg_id() ? draft.vreply_to_msg_id.v : MsgId(0);
|
|
||||||
auto cloudDraft = std::make_unique<Draft>(
|
auto cloudDraft = std::make_unique<Draft>(
|
||||||
textWithTags,
|
textWithTags,
|
||||||
replyTo,
|
replyTo,
|
||||||
@@ -80,7 +80,7 @@ void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
|||||||
|
|
||||||
void clearPeerCloudDraft(PeerId peerId, TimeId date) {
|
void clearPeerCloudDraft(PeerId peerId, TimeId date) {
|
||||||
const auto history = App::history(peerId);
|
const auto history = App::history(peerId);
|
||||||
if (history->skipCloudDraft(QString(), date)) {
|
if (history->skipCloudDraft(QString(), MsgId(0), date)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -512,8 +512,11 @@ Data::Draft *History::createCloudDraft(const Data::Draft *fromDraft) {
|
|||||||
return cloudDraft();
|
return cloudDraft();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool History::skipCloudDraft(const QString &text, TimeId date) const {
|
bool History::skipCloudDraft(const QString &text, MsgId replyTo, TimeId date) const {
|
||||||
if (date > 0 && date <= _lastSentDraftTime + kSkipCloudDraftsFor) {
|
if (Data::draftStringIsEmpty(text)
|
||||||
|
&& !replyTo
|
||||||
|
&& date > 0
|
||||||
|
&& date <= _lastSentDraftTime + kSkipCloudDraftsFor) {
|
||||||
return true;
|
return true;
|
||||||
} else if (_lastSentDraftText && *_lastSentDraftText == text) {
|
} else if (_lastSentDraftText && *_lastSentDraftText == text) {
|
||||||
return true;
|
return true;
|
||||||
|
@@ -326,7 +326,7 @@ public:
|
|||||||
void createLocalDraftFromCloud();
|
void createLocalDraftFromCloud();
|
||||||
void setCloudDraft(std::unique_ptr<Data::Draft> &&draft);
|
void setCloudDraft(std::unique_ptr<Data::Draft> &&draft);
|
||||||
Data::Draft *createCloudDraft(const Data::Draft *fromDraft);
|
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 setSentDraftText(const QString &text);
|
||||||
void clearSentDraftText(const QString &text);
|
void clearSentDraftText(const QString &text);
|
||||||
void setEditDraft(std::unique_ptr<Data::Draft> &&draft);
|
void setEditDraft(std::unique_ptr<Data::Draft> &&draft);
|
||||||
|
2
Telegram/ThirdParty/libtgvoip
vendored
2
Telegram/ThirdParty/libtgvoip
vendored
Submodule Telegram/ThirdParty/libtgvoip updated: 78e584c443...fb0a2b0c9b
Reference in New Issue
Block a user