mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-28 19:40:54 +00:00
Fix text disappearing in support mode.
This commit is contained in:
parent
0a5589f869
commit
aa1090a585
@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_session.h"
|
||||
#include "mainwidget.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "support/support_helper.h"
|
||||
|
||||
namespace Data {
|
||||
namespace {
|
||||
@ -66,17 +65,7 @@ void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
||||
cloudDraft->date = draft.vdate.v;
|
||||
|
||||
history->setCloudDraft(std::move(cloudDraft));
|
||||
history->createLocalDraftFromCloud();
|
||||
if (Auth().supportMode()) {
|
||||
history->updateChatListEntry();
|
||||
Auth().supportHelper().cloudDraftChanged(history);
|
||||
} else {
|
||||
history->updateChatListSortPosition();
|
||||
}
|
||||
|
||||
if (const auto main = App::main()) {
|
||||
main->applyCloudDraft(history);
|
||||
}
|
||||
history->applyCloudDraft();
|
||||
}
|
||||
|
||||
void clearPeerCloudDraft(PeerId peerId, TimeId date) {
|
||||
@ -86,18 +75,7 @@ void clearPeerCloudDraft(PeerId peerId, TimeId date) {
|
||||
}
|
||||
|
||||
history->clearCloudDraft();
|
||||
history->clearLocalDraft();
|
||||
|
||||
if (Auth().supportMode()) {
|
||||
history->updateChatListEntry();
|
||||
Auth().supportHelper().cloudDraftChanged(history);
|
||||
} else {
|
||||
history->updateChatListSortPosition();
|
||||
}
|
||||
|
||||
if (auto main = App::main()) {
|
||||
main->applyCloudDraft(history);
|
||||
}
|
||||
history->applyCloudDraft();
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/history_inner_widget.h"
|
||||
#include "dialogs/dialogs_indexed_list.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_media_types.h"
|
||||
@ -22,14 +21,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "apiwrap.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "observer_peer.h"
|
||||
#include "auth_session.h"
|
||||
#include "window/notifications_manager.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "storage/storage_facade.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_feed_messages.h"
|
||||
#include "support/support_helper.h"
|
||||
#include "data/data_channel_admins.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_photo.h"
|
||||
@ -39,6 +39,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "core/crash_reports.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -199,10 +200,11 @@ void History::takeLocalDraft(History *from) {
|
||||
}
|
||||
|
||||
void History::createLocalDraftFromCloud() {
|
||||
auto draft = cloudDraft();
|
||||
if (Data::draftIsNull(draft)
|
||||
|| !draft->date
|
||||
|| session().supportMode()) {
|
||||
const auto draft = cloudDraft();
|
||||
if (!draft) {
|
||||
clearLocalDraft();
|
||||
return;
|
||||
} else if (Data::draftIsNull(draft) || !draft->date) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -303,6 +305,19 @@ void History::clearCloudDraft() {
|
||||
}
|
||||
}
|
||||
|
||||
void History::applyCloudDraft() {
|
||||
if (session().supportMode()) {
|
||||
updateChatListEntry();
|
||||
session().supportHelper().cloudDraftChanged(this);
|
||||
} else {
|
||||
createLocalDraftFromCloud();
|
||||
updateChatListSortPosition();
|
||||
if (const auto main = App::main()) {
|
||||
main->applyCloudDraft(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void History::clearEditDraft() {
|
||||
_editDraft = nullptr;
|
||||
}
|
||||
|
@ -257,7 +257,6 @@ public:
|
||||
}
|
||||
void setLocalDraft(std::unique_ptr<Data::Draft> &&draft);
|
||||
void takeLocalDraft(History *from);
|
||||
void createLocalDraftFromCloud();
|
||||
void setCloudDraft(std::unique_ptr<Data::Draft> &&draft);
|
||||
Data::Draft *createCloudDraft(const Data::Draft *fromDraft);
|
||||
bool skipCloudDraft(const QString &text, MsgId replyTo, TimeId date) const;
|
||||
@ -266,6 +265,7 @@ public:
|
||||
void setEditDraft(std::unique_ptr<Data::Draft> &&draft);
|
||||
void clearLocalDraft();
|
||||
void clearCloudDraft();
|
||||
void applyCloudDraft();
|
||||
void clearEditDraft();
|
||||
void draftSavedToCloud();
|
||||
Data::Draft *draft() {
|
||||
@ -448,6 +448,8 @@ private:
|
||||
|
||||
void viewReplaced(not_null<const Element*> was, Element *now);
|
||||
|
||||
void createLocalDraftFromCloud();
|
||||
|
||||
not_null<Data::Session*> _owner;
|
||||
Flags _flags = 0;
|
||||
bool _mute = false;
|
||||
|
@ -1464,6 +1464,8 @@ void HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
|
||||
}
|
||||
|
||||
void HistoryWidget::applyCloudDraft(History *history) {
|
||||
Expects(!Auth().supportMode());
|
||||
|
||||
if (_history == history && !_editMsgId) {
|
||||
applyDraft(Ui::InputField::HistoryAction::NewEntry);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user