mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Support [inputN|n]otifyBroadcasts setting.
This commit is contained in:
@@ -1813,7 +1813,9 @@ void Session::requestNotifySettings(not_null<PeerData*> peer) {
|
||||
if (defaultNotifySettings(peer).settingsUnknown()) {
|
||||
_session->api().requestNotifySettings(peer->isUser()
|
||||
? MTP_inputNotifyUsers()
|
||||
: MTP_inputNotifyChats());
|
||||
: (peer->isChat() || peer->isMegagroup())
|
||||
? MTP_inputNotifyChats()
|
||||
: MTP_inputNotifyBroadcasts());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1840,7 +1842,7 @@ void Session::applyNotifySetting(
|
||||
if (_defaultChatNotifySettings.change(settings)) {
|
||||
_defaultChatNotifyUpdates.fire({});
|
||||
|
||||
App::enumerateChatsChannels([&](not_null<PeerData*> peer) {
|
||||
App::enumerateGroups([&](not_null<PeerData*> peer) {
|
||||
if (!peer->notifySettingsUnknown()
|
||||
&& ((!peer->notifyMuteUntil()
|
||||
&& _defaultChatNotifySettings.muteUntil())
|
||||
@@ -1851,6 +1853,21 @@ void Session::applyNotifySetting(
|
||||
});
|
||||
}
|
||||
} break;
|
||||
case mtpc_notifyBroadcasts: {
|
||||
if (_defaultBroadcastNotifySettings.change(settings)) {
|
||||
_defaultBroadcastNotifyUpdates.fire({});
|
||||
|
||||
App::enumerateChannels([&](not_null<ChannelData*> channel) {
|
||||
if (!channel->notifySettingsUnknown()
|
||||
&& ((!channel->notifyMuteUntil()
|
||||
&& _defaultBroadcastNotifySettings.muteUntil())
|
||||
|| (!channel->notifySilentPosts()
|
||||
&& _defaultBroadcastNotifySettings.silentPosts()))) {
|
||||
updateNotifySettingsLocal(channel);
|
||||
}
|
||||
});
|
||||
}
|
||||
} break;
|
||||
case mtpc_notifyPeer: {
|
||||
const auto &data = notifyPeer.c_notifyPeer();
|
||||
if (const auto peer = App::peerLoaded(peerFromMTP(data.vpeer))) {
|
||||
@@ -1937,11 +1954,17 @@ rpl::producer<> Session::defaultChatNotifyUpdates() const {
|
||||
return _defaultChatNotifyUpdates.events();
|
||||
}
|
||||
|
||||
rpl::producer<> Session::defaultBroadcastNotifyUpdates() const {
|
||||
return _defaultBroadcastNotifyUpdates.events();
|
||||
}
|
||||
|
||||
rpl::producer<> Session::defaultNotifyUpdates(
|
||||
not_null<const PeerData*> peer) const {
|
||||
return peer->isUser()
|
||||
? defaultUserNotifyUpdates()
|
||||
: defaultChatNotifyUpdates();
|
||||
: (peer->isChat() || peer->isMegagroup())
|
||||
? defaultChatNotifyUpdates()
|
||||
: defaultBroadcastNotifyUpdates();
|
||||
}
|
||||
|
||||
void Session::serviceNotification(
|
||||
|
Reference in New Issue
Block a user