Show pin confirmation correctly in topics.
This commit is contained in:
parent
b782569faf
commit
05b8b9f22e
|
@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "history/history.h"
|
||||||
|
#include "history/history_item.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
|
@ -41,15 +43,17 @@ namespace {
|
||||||
|
|
||||||
void PinMessageBox(
|
void PinMessageBox(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
not_null<PeerData*> peer,
|
not_null<HistoryItem*> item) {
|
||||||
MsgId msgId) {
|
|
||||||
struct State {
|
struct State {
|
||||||
QPointer<Ui::Checkbox> pinForPeer;
|
QPointer<Ui::Checkbox> pinForPeer;
|
||||||
QPointer<Ui::Checkbox> notify;
|
QPointer<Ui::Checkbox> notify;
|
||||||
mtpRequestId requestId = 0;
|
mtpRequestId requestId = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto pinningOld = IsOldForPin(msgId, peer, MsgId(0));
|
const auto peer = item->history()->peer;
|
||||||
|
const auto msgId = item->id;
|
||||||
|
const auto topicRootId = item->topic() ? item->topicRootId() : MsgId();
|
||||||
|
const auto pinningOld = IsOldForPin(msgId, peer, topicRootId);
|
||||||
const auto state = box->lifetime().make_state<State>();
|
const auto state = box->lifetime().make_state<State>();
|
||||||
const auto api = box->lifetime().make_state<MTP::Sender>(
|
const auto api = box->lifetime().make_state<MTP::Sender>(
|
||||||
&peer->session().mtp());
|
&peer->session().mtp());
|
||||||
|
|
|
@ -13,5 +13,4 @@ class GenericBox;
|
||||||
|
|
||||||
void PinMessageBox(
|
void PinMessageBox(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
not_null<PeerData*> peer,
|
not_null<HistoryItem*> item);
|
||||||
MsgId msgId);
|
|
||||||
|
|
|
@ -2154,7 +2154,7 @@ void ToggleMessagePinned(
|
||||||
}
|
}
|
||||||
if (pin) {
|
if (pin) {
|
||||||
navigation->parentController()->show(
|
navigation->parentController()->show(
|
||||||
Box(PinMessageBox, item->history()->peer, item->id),
|
Box(PinMessageBox, item),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
} else {
|
} else {
|
||||||
const auto peer = item->history()->peer;
|
const auto peer = item->history()->peer;
|
||||||
|
|
Loading…
Reference in New Issue