mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-02 07:25:46 +00:00
Fix client side generated changelogs display.
Also use message date if available in MediaView.
This commit is contained in:
@@ -212,71 +212,6 @@ void MainWindow::setupIntro() {
|
||||
}
|
||||
|
||||
fixOrder();
|
||||
|
||||
_delayedServiceMsgs.clear();
|
||||
if (_serviceHistoryRequest) {
|
||||
MTP::cancel(_serviceHistoryRequest);
|
||||
_serviceHistoryRequest = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::serviceNotification(const TextWithEntities &message, const MTPMessageMedia &media, int32 date, bool force) {
|
||||
if (date <= 0) date = unixtime();
|
||||
auto h = (_main && App::userLoaded(ServiceUserId)) ? App::history(ServiceUserId).get() : nullptr;
|
||||
if (!h || (!force && h->isEmpty())) {
|
||||
_delayedServiceMsgs.push_back(DelayedServiceMsg(message, media, date));
|
||||
return sendServiceHistoryRequest();
|
||||
}
|
||||
|
||||
_main->insertCheckedServiceNotification(message, media, date);
|
||||
}
|
||||
|
||||
void MainWindow::showDelayedServiceMsgs() {
|
||||
for (auto &delayed : base::take(_delayedServiceMsgs)) {
|
||||
serviceNotification(delayed.message, delayed.media, delayed.date, true);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::sendServiceHistoryRequest() {
|
||||
if (!_main || !_main->started() || _delayedServiceMsgs.isEmpty() || _serviceHistoryRequest) return;
|
||||
|
||||
auto user = App::userLoaded(ServiceUserId);
|
||||
if (!user) {
|
||||
auto userFlags = MTPDuser::Flag::f_first_name | MTPDuser::Flag::f_phone | MTPDuser::Flag::f_status | MTPDuser::Flag::f_verified;
|
||||
user = App::feedUsers(MTP_vector<MTPUser>(1, MTP_user(
|
||||
MTP_flags(userFlags),
|
||||
MTP_int(ServiceUserId),
|
||||
MTPlong(),
|
||||
MTP_string("Telegram"),
|
||||
MTPstring(),
|
||||
MTPstring(),
|
||||
MTP_string("42777"),
|
||||
MTP_userProfilePhotoEmpty(),
|
||||
MTP_userStatusRecently(),
|
||||
MTPint(),
|
||||
MTPstring(),
|
||||
MTPstring(),
|
||||
MTPstring())));
|
||||
}
|
||||
auto offsetId = 0;
|
||||
auto offsetDate = 0;
|
||||
auto addOffset = 0;
|
||||
auto limit = 1;
|
||||
auto maxId = 0;
|
||||
auto minId = 0;
|
||||
auto historyHash = 0;
|
||||
_serviceHistoryRequest = MTP::send(
|
||||
MTPmessages_GetHistory(
|
||||
user->input,
|
||||
MTP_int(offsetId),
|
||||
MTP_int(offsetDate),
|
||||
MTP_int(addOffset),
|
||||
MTP_int(limit),
|
||||
MTP_int(maxId),
|
||||
MTP_int(minId),
|
||||
MTP_int(historyHash)),
|
||||
_main->rpcDone(&MainWidget::serviceHistoryDone),
|
||||
_main->rpcFail(&MainWidget::serviceHistoryFail));
|
||||
}
|
||||
|
||||
void MainWindow::setupMain() {
|
||||
|
Reference in New Issue
Block a user