Fixed display of archiving toasts on wrong window.
This commit is contained in:
parent
9201cf24f1
commit
01906c1161
|
@ -714,8 +714,9 @@ void ContactStatus::setupShareHandler(not_null<UserData*> user) {
|
|||
|
||||
void ContactStatus::setupUnarchiveHandler(not_null<PeerData*> peer) {
|
||||
_inner->unarchiveClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
Window::ToggleHistoryArchived(peer->owner().history(peer), false);
|
||||
) | rpl::start_with_next([=, show = _controller->uiShow()] {
|
||||
using namespace Window;
|
||||
ToggleHistoryArchived(show, peer->owner().history(peer), false);
|
||||
peer->owner().notifySettings().resetToDefault(peer);
|
||||
if (const auto settings = peer->settings()) {
|
||||
const auto flags = PeerSetting::AutoArchived
|
||||
|
|
|
@ -652,8 +652,8 @@ void Filler::addToggleArchive() {
|
|||
? tr::lng_archived_remove(tr::now)
|
||||
: tr::lng_archived_add(tr::now);
|
||||
};
|
||||
const auto toggle = [=] {
|
||||
ToggleHistoryArchived(history, !isArchived());
|
||||
const auto toggle = [=, show = _controller->uiShow()] {
|
||||
ToggleHistoryArchived(show, history, !isArchived());
|
||||
};
|
||||
const auto archiveAction = _addAction(
|
||||
label(),
|
||||
|
@ -2406,9 +2406,12 @@ void MenuAddMarkAsReadChatListAction(
|
|||
&st::menuIconMarkRead);
|
||||
}
|
||||
|
||||
void ToggleHistoryArchived(not_null<History*> history, bool archived) {
|
||||
void ToggleHistoryArchived(
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
not_null<History*> history,
|
||||
bool archived) {
|
||||
const auto callback = [=] {
|
||||
Ui::Toast::Show(Ui::Toast::Config{
|
||||
show->showToast(Ui::Toast::Config{
|
||||
.text = { (archived
|
||||
? tr::lng_archived_added(tr::now)
|
||||
: tr::lng_archived_removed(tr::now)) },
|
||||
|
|
|
@ -116,7 +116,10 @@ void BlockSenderFromRepliesBox(
|
|||
not_null<Window::SessionController*> controller,
|
||||
FullMsgId id);
|
||||
|
||||
void ToggleHistoryArchived(not_null<History*> history, bool archived);
|
||||
void ToggleHistoryArchived(
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
not_null<History*> history,
|
||||
bool archived);
|
||||
Fn<void()> ClearHistoryHandler(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> peer);
|
||||
|
|
Loading…
Reference in New Issue