Request common notify settings when needed.

If user / group has default notify settings we need common user
or common group notify settings to display the badge properly.
This commit is contained in:
John Preston 2018-06-06 22:56:35 +03:00
parent d6a00523a8
commit 866c5e9b7b
6 changed files with 24 additions and 11 deletions

View File

@ -487,10 +487,10 @@ private:
QMap<uint64, QPair<uint64, mtpRequestId> > _stickerSetRequests;
QMap<ChannelData*, mtpRequestId> _channelAmInRequests;
std::map<not_null<UserData*>, mtpRequestId> _blockRequests;
std::map<not_null<PeerData*>, mtpRequestId> _exportInviteRequests;
std::map<PeerId, mtpRequestId> _notifySettingRequests;
std::map<not_null<History*>, mtpRequestId> _draftsSaveRequestIds;
base::flat_map<not_null<UserData*>, mtpRequestId> _blockRequests;
base::flat_map<not_null<PeerData*>, mtpRequestId> _exportInviteRequests;
base::flat_map<PeerId, mtpRequestId> _notifySettingRequests;
base::flat_map<not_null<History*>, mtpRequestId> _draftsSaveRequestIds;
base::Timer _draftsSaveTimer;
base::flat_set<mtpRequestId> _stickerSetDisenableRequests;

View File

@ -13,6 +13,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace base {
using std::begin;
using std::end;
template <
typename Key,
typename Type,
@ -424,6 +427,9 @@ public:
iterator erase(const_iterator from, const_iterator till) {
return impl().erase(from._impl, till._impl);
}
int erase(const Key &key) {
return removeAll(key);
}
iterator findFirst(const Key &key) {
if (empty()

View File

@ -12,6 +12,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace base {
using std::begin;
using std::end;
template <typename Type, typename Compare = std::less<>>
class flat_set;
@ -304,6 +307,9 @@ public:
iterator erase(const_iterator from, const_iterator till) {
return impl().erase(from._impl, till._impl);
}
int erase(const Type &value) {
return removeAll(value);
}
iterator findFirst(const Type &value) {
if (empty()

View File

@ -1692,12 +1692,9 @@ void Session::applyNotifySetting(
App::enumerateChatsChannels([&](not_null<PeerData*> peer) {
if (!peer->notifySettingsUnknown()
&& ((!peer->notifyMuteUntil()
&& _defaultUserNotifySettings.muteUntil())
&& _defaultChatNotifySettings.muteUntil())
|| (!peer->notifySilentPosts()
&& _defaultUserNotifySettings.silentPosts()))) {
if (!peer->notifyMuteUntil()) {
int a = 0;
}
&& _defaultChatNotifySettings.silentPosts()))) {
updateNotifySettingsLocal(peer);
}
});

View File

@ -2197,6 +2197,10 @@ void History::applyDialog(const MTPDdialog &data) {
Auth().data().applyNotifySetting(
MTP_notifyPeer(data.vpeer),
data.vnotify_settings);
// Request default notification settings for this type of chat.
Auth().data().requestNotifySettings(peer);
if (data.has_draft() && data.vdraft.type() == mtpc_draftMessage) {
Data::applyPeerCloudDraft(peer->id, data.vdraft.c_draftMessage());
}

View File

@ -476,9 +476,9 @@ void Navigation::showPeerInfo(
void Controller::showSection(
SectionMemento &&memento,
const SectionShow &params) {
if (App::wnd()->showSectionInExistingLayer(
if (!params.thirdColumn && App::wnd()->showSectionInExistingLayer(
&memento,
params) && !params.thirdColumn) {
params)) {
return;
}
App::main()->showSection(std::move(memento), params);