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