Reset notify settings on unarchive.

This commit is contained in:
John Preston 2020-07-06 14:26:00 +04:00
parent 5c5414b680
commit 152b49c65c
3 changed files with 15 additions and 1 deletions

View File

@ -3593,6 +3593,19 @@ void Session::updateNotifySettings(
}
}
void Session::resetNotifySettingsToDefault(not_null<PeerData*> peer) {
const auto empty = MTP_peerNotifySettings(
MTP_flags(0),
MTPBool(),
MTPBool(),
MTPint(),
MTPstring());
if (peer->notifyChange(empty)) {
updateNotifySettingsLocal(peer);
_session->api().updateNotifySettingsDelayed(peer);
}
}
bool Session::notifyIsMuted(
not_null<const PeerData*> peer,
crl::time *changesIn) const {

View File

@ -596,6 +596,7 @@ public:
not_null<PeerData*> peer,
std::optional<int> muteForSeconds,
std::optional<bool> silentPosts = std::nullopt);
void resetNotifySettingsToDefault(not_null<PeerData*> peer);
bool notifyIsMuted(
not_null<const PeerData*> peer,
crl::time *changesIn = nullptr) const;

View File

@ -367,7 +367,7 @@ void ContactStatus::setupUnarchiveHandler(not_null<PeerData*> peer) {
_bar.entity()->unarchiveClicks(
) | rpl::start_with_next([=] {
Window::ToggleHistoryArchived(peer->owner().history(peer), false);
peer->owner().updateNotifySettings(peer, 0);
peer->owner().resetNotifySettingsToDefault(peer);
if (const auto settings = peer->settings()) {
using Flag = MTPDpeerSettings::Flag;
const auto flags = Flag::f_autoarchived