2026-10-12 06:59:38 +00:00
// Module ID: 6804
// Function ID: 6805
2026-09-10 05:38:07 +00:00
// Name: NotificationSettingsUtils
2026-10-12 06:59:38 +00:00
// Dependencies: [6805, 2065, 5432, 5966, 1085, 4763, 5967, 1095, 1403, 5107, 1265, 2]
2026-07-29 08:29:29 +00:00
// Exports: getCurrentChannelSettings, getCurrentGuildSettings, getManyCurrentChannelSettings, getManyCurrentGuildSettings, muteConfigToTimestamp, trackAccountNotificationSettingUpdated, trackChannelNotificationSettingsUpdate, trackGuildNotificationSettingsUpdate
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 6804 (NotificationSettingsUtils)
2026-10-09 10:00:15 +00:00
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1265 */ ;
import FlagUtils from "FlagUtils" /* 1403 */ ;
2026-10-10 08:08:14 +00:00
import NotificationConstants from "NotificationConstants" /* 4763 */ ;
import AppAnalyticsUtilsDefault from "AppAnalyticsUtils" /* 5107 */ ;
import ReadStateConstants from "ReadStateConstants" /* 5967 */ ;
2026-10-12 06:59:38 +00:00
import LastMentionTimestampStore from "LastMentionTimestampStore" /* 6805 */ ;
2026-10-10 08:08:14 +00:00
import ChannelStore from "ChannelStore" /* 2065 */ ;
import MessageStore from "MessageStore" /* 5432 */ ;
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 5966 */ ;
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */ ;
import UserSettingsConstants from "UserSettingsConstants" /* 1095 */ ;
import size from "module_2" /* 2 */ ;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let map , set ;
2026-09-10 05:38:07 +00:00
2026-10-03 08:58:59 +00:00
let UserNotificationSettings ;
let closure_12 ;
let metroImportDefault ;
let unpackModuleId ;
( { AnalyticEvents : metroImportDefault , UserNotificationSettings } = Constants ) ;
const constants2 = NotificationConstants . NotificationSettingsUpdateType ;
const UnreadSetting = ReadStateConstants . UnreadSetting ;
( { ChannelNotificationSettingsFlags : unpackModuleId , GuildNotificationSettingsFlags : closure_12 } = UserSettingsConstants ) ;
const NotificationLabels = { ForumThreadsCreatedOn : "enabled forum thread created notifs" , ForumThreadsCreatedOff : "disabled forum thread created notifs" , SuppressEveryoneOn : "enabled suppress everyone" , SuppressEveryoneOff : "disabled suppress everyone" , SuppressRolesOn : "enabled suppress roles" , SuppressRolesOff : "disabled suppress roles" , HighlightsOn : "enabled highlights" , HighlightsOff : "disabled highlights" , MobilePushOn : "enabled mobile push notifications" , MobilePushOff : "disabled mobile push notifications" , UnreadsAll : "unreads set to all messages" , UnreadsMentions : "unreads set to mentions" , UnreadsDefault : "unreads set to the default" , NotificationsAll : "notifications set to all messages" , NotificationsMentions : "notifications set to mentions" , NotificationsNothing : "notifications set to nothing" , NotificationsDefault : "notifications set to the default" , PresetAll : "notification preset set to all messages" , PresetHybrid : "notification preset set to hybrid" , PresetMentions : "notification preset set to mentions" , PresetNothing : "notification preset set to nothing" , PresetDefault : "notification preset set to the default" , OptedIn : "opted in to entity" , OptedOut : "opted out from entity" , Favorited : "favorited" , UnFavorited : "unfavorited" , Muted : "muted" , Unmuted : "unmuted" , MutedScheduledEvents : "muted scheduled events" , UnmutedScheduledEvents : "unmuted scheduled events" , OverrideCreated : "channel override created" , OverrideDeleted : "channel override deleted" , AnnouncementAutoEnable : "announcement channels auto set to all messages" } ;
let obj2 = {
2026-07-20 16:05:17 +00:00
forumThreadsCreated ( arg0 ) {
return arg0 ? obj.ForumThreadsCreatedOn : obj.ForumThreadsCreatedOff ;
} ,
suppressEveryone ( arg0 ) {
return arg0 ? obj.SuppressEveryoneOn : obj.SuppressEveryoneOff ;
} ,
suppressRoles ( arg0 ) {
return arg0 ? obj.SuppressRolesOn : obj.SuppressRolesOff ;
} ,
highlights ( arg0 ) {
return arg0 ? obj.HighlightsOn : obj.HighlightsOff ;
} ,
mobilePush ( arg0 ) {
return arg0 ? obj.MobilePushOn : obj.MobilePushOff ;
} ,
2026-09-10 05:38:07 +00:00
optedIn ( optInEnabled ) {
return optInEnabled ? obj.OptedIn : obj.OptedOut ;
2026-07-20 16:05:17 +00:00
} ,
favorited ( arg0 ) {
return arg0 ? obj.Favorited : obj.UnFavorited ;
} ,
2026-10-03 08:58:59 +00:00
muted ( isModerator ) {
return isModerator ? obj.Muted : obj.Unmuted ;
2026-07-20 16:05:17 +00:00
} ,
mutedEvents ( arg0 ) {
return arg0 ? obj.MutedScheduledEvents : obj.UnmutedScheduledEvents ;
} ,
2026-09-10 05:38:07 +00:00
unreads ( toggleExpandedHistory ) {
2026-10-03 08:58:59 +00:00
let UnreadsDefault ;
2026-09-10 05:38:07 +00:00
if ( toggleExpandedHistory === UnreadSetting . ALL_MESSAGES ) {
2026-10-03 08:58:59 +00:00
UnreadsDefault = obj . UnreadsAll ;
2026-09-10 05:38:07 +00:00
} else if ( toggleExpandedHistory === tmp . ONLY_MENTIONS ) {
2026-07-20 16:05:17 +00:00
UnreadsDefault = obj . UnreadsMentions ;
} else {
UnreadsDefault = obj . UnreadsDefault ;
}
return UnreadsDefault ;
} ,
2026-09-10 05:38:07 +00:00
notifications ( message_notifications ) {
2026-10-03 08:58:59 +00:00
let NotificationsDefault ;
2026-09-10 05:38:07 +00:00
if ( message_notifications === UserNotificationSettings . ALL_MESSAGES ) {
2026-10-03 08:58:59 +00:00
NotificationsDefault = obj . NotificationsAll ;
} else if ( message_notifications === UserNotificationSettings . ONLY_MENTIONS ) {
2026-07-20 16:05:17 +00:00
NotificationsDefault = obj . NotificationsMentions ;
2026-10-03 08:58:59 +00:00
} else if ( message_notifications === UserNotificationSettings . NO_MESSAGES ) {
2026-07-20 16:05:17 +00:00
NotificationsDefault = obj . NotificationsNothing ;
} else {
NotificationsDefault = obj . NotificationsDefault ;
}
return NotificationsDefault ;
}
} ;
2026-10-03 08:58:59 +00:00
const frozen = Object . freeze ( { [ UserNotificationSettings . ALL_MESSAGES ] : "All" , [ UserNotificationSettings . ONLY_MENTIONS ] : "Mentions" , [ UserNotificationSettings . NO_MESSAGES ] : "Nothing" , [ UserNotificationSettings . NULL ] : null } ) ;
const result = size . fileFinishedImporting ( "utils/NotificationSettingsUtils.tsx" ) ;
export { NotificationLabels } ;
export const NotificationLabel = obj2 ;
2026-07-20 16:05:17 +00:00
export const MessageNotificationSettings = frozen ;
2026-07-29 08:29:29 +00:00
export const trackGuildNotificationSettingsUpdate = function trackGuildNotificationSettingsUpdate ( guild_id , muteSettings , currentGuildSettings , label , location ) {
2026-10-03 08:58:59 +00:00
let guild_flags ;
let guild_is_muted ;
let guild_suppress_roles ;
let prop ;
let prop1 ;
let prop2 ;
let prop3 ;
let prop4 ;
let time ;
2026-07-29 08:29:29 +00:00
function compute ( guild_message_notification_settings , muteSettings ) {
2026-10-03 08:58:59 +00:00
let guild_flags ;
let guild_is_muted ;
let guild_notify_highlights ;
let guild_receive_mobile_push ;
let guild_scheduled_events_muted ;
let guild_suppress_everyone ;
let guild_suppress_roles ;
2026-09-10 05:38:07 +00:00
let obj = muteSettings ;
2026-07-20 16:05:17 +00:00
if ( muteSettings === undefined ) {
obj = { } ;
}
if ( null != obj . mute_config ) {
2026-10-03 08:58:59 +00:00
let guild_muted_until ;
2026-07-20 16:05:17 +00:00
if ( null != obj . mute_config . end_time ) {
const _Date = Date ;
2026-10-03 08:58:59 +00:00
const self = this ;
const self2 = this ;
2026-07-20 16:05:17 +00:00
const date = new Date ( obj . mute_config . end_time ) ;
2026-10-03 08:58:59 +00:00
guild_muted_until = date . getTime ( ) ;
2026-07-20 16:05:17 +00:00
}
if ( null != obj . message_notifications ) {
2026-09-10 05:38:07 +00:00
guild_message_notification_settings = frozen [ obj . message_notifications ] ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
guild_message_notification_settings = guild_message_notification_settings . guild_message_notification_settings ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const obj2 = { guild_muted_until , guild_flags , guild_is_muted , guild_message_notification_settings , guild_suppress_roles , guild_receive_mobile_push , guild_notify_highlights , guild_suppress_everyone , guild_scheduled_events_muted } ;
guild_flags = obj . flags ;
2026-07-29 08:29:29 +00:00
if ( guild_flags == null ) {
guild_flags = guild_message_notification_settings . guild_flags ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
guild_is_muted = obj . muted ;
2026-07-29 08:29:29 +00:00
if ( guild_is_muted == null ) {
guild_is_muted = guild_message_notification_settings . guild_is_muted ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
guild_suppress_roles = obj . suppress_roles ;
2026-07-29 08:29:29 +00:00
if ( guild_suppress_roles == null ) {
guild_suppress_roles = guild_message_notification_settings . guild_suppress_roles ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
guild_receive_mobile_push = obj . mobile_push ;
2026-07-29 08:29:29 +00:00
if ( guild_receive_mobile_push == null ) {
guild_receive_mobile_push = guild_message_notification_settings . guild_receive_mobile_push ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
guild_notify_highlights = obj . notify_highlights ;
2026-07-29 08:29:29 +00:00
if ( guild_notify_highlights == null ) {
guild_notify_highlights = guild_message_notification_settings . guild_notify_highlights ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
guild_suppress_everyone = obj . suppress_everyone ;
2026-07-29 08:29:29 +00:00
if ( guild_suppress_everyone == null ) {
guild_suppress_everyone = guild_message_notification_settings . guild_suppress_everyone ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
guild_scheduled_events_muted = obj . mute_scheduled_events ;
2026-07-29 08:29:29 +00:00
if ( guild_scheduled_events_muted == null ) {
guild_scheduled_events_muted = guild_message_notification_settings . guild_scheduled_events_muted ;
2026-07-20 16:05:17 +00:00
}
2026-09-10 05:38:07 +00:00
return obj2 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
guild_muted_until = guild_message_notification_settings . guild_muted_until ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const computeResult = compute ( currentGuildSettings ) ;
2026-10-03 08:58:59 +00:00
let obj = UserGuildSettingsStore ;
const isMutedResult = UserGuildSettingsStore . isMuted ( guild_id ) ;
2026-09-10 05:38:07 +00:00
const muteConfig = UserGuildSettingsStore . getMuteConfig ( guild_id ) ;
2026-10-03 08:58:59 +00:00
let obj2 = { guild_suppress_everyone : UserGuildSettingsStore.isSuppressEveryoneEnabled ( guild_id ) , guild_suppress_roles : UserGuildSettingsStore.isSuppressRolesEnabled ( guild_id ) , guild_scheduled_events_muted : UserGuildSettingsStore.isMuteScheduledEventsEnabled ( guild_id ) , guild_is_muted : isMutedResult , guild_muted_until : time , guild_receive_mobile_push : obj.isMobilePushEnabled ( guild_id ) , guild_message_notification_settings : frozen [ obj . getMessageNotifications ( obj , guild_id ) ] , guild_notify_highlights : obj.getNotifyHighlights ( guild_id ) , guild_flags : obj.getGuildFlags ( guild_id ) } ;
time = null ;
2026-07-29 08:29:29 +00:00
if ( null != muteConfig ) {
time = null ;
if ( null != muteConfig . end_time ) {
let _Date = Date ;
2026-10-03 08:58:59 +00:00
let self = this ;
let self2 = this ;
2026-07-29 08:29:29 +00:00
let date = new Date ( muteConfig . end_time ) ;
time = date . getTime ( ) ;
}
2026-07-20 16:05:17 +00:00
}
2026-09-10 05:38:07 +00:00
const computeResult1 = compute ( obj2 , muteSettings ) ;
2026-07-29 08:29:29 +00:00
let num ;
if ( computeResult . guild_flags !== computeResult1 . guild_flags ) {
num = computeResult . guild_flags ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( num == null ) {
num = 0 ;
}
let num2 = computeResult1 . guild_flags ;
if ( num2 == null ) {
num2 = 0 ;
}
2026-10-03 08:58:59 +00:00
const tmp8 = num2 ^ num ;
const obj4 = FlagUtils ;
const obj3 = { location , guild_id , update_type : constants2.GUILD , label , guild_flags_old : guild_flags , guild_is_muted_old : guild_is_muted , guild_suppress_roles_old : guild_suppress_roles , guild_notify_highlights_old : prop , guild_suppress_everyone_old : prop1 , guild_receive_mobile_push_old : prop2 , guild_scheduled_events_muted_old : prop3 , guild_message_notification_settings_old : prop4 , is_opt_in_only_change : 0 === obj4 . removeFlags ( tmp8 , constants4 . OPT_IN_CHANNELS_OFF , constants4 . OPT_IN_CHANNELS_ON ) } ;
const trackWithMetadata = AppAnalyticsUtilsDefault . trackWithMetadata ;
const NOTIFICATION_SETTINGS_UPDATED = metroImportDefault . NOTIFICATION_SETTINGS_UPDATED ;
AppAnalyticsUtilsDefault ;
2026-07-20 16:05:17 +00:00
const merged = Object . assign ( computeResult1 ) ;
2026-09-10 05:38:07 +00:00
const merged1 = Object . assign ( LastMentionTimestampStore . getStats ( guild_id ) ) ;
2026-10-03 08:58:59 +00:00
guild_flags = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . guild_flags !== computeResult1 . guild_flags ) {
guild_flags = computeResult . guild_flags ;
}
2026-10-03 08:58:59 +00:00
guild_is_muted = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . guild_is_muted !== computeResult1 . guild_is_muted ) {
guild_is_muted = computeResult . guild_is_muted ;
}
2026-10-03 08:58:59 +00:00
guild_suppress_roles = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . guild_suppress_roles !== computeResult1 . guild_suppress_roles ) {
guild_suppress_roles = computeResult . guild_suppress_roles ;
}
2026-10-03 08:58:59 +00:00
prop = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . guild_notify_highlights !== computeResult1 . guild_notify_highlights ) {
prop = computeResult . guild_notify_highlights ;
}
2026-10-03 08:58:59 +00:00
prop1 = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . guild_suppress_everyone !== computeResult1 . guild_suppress_everyone ) {
prop1 = computeResult . guild_suppress_everyone ;
}
2026-10-03 08:58:59 +00:00
prop2 = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . guild_receive_mobile_push !== computeResult1 . guild_receive_mobile_push ) {
prop2 = computeResult . guild_receive_mobile_push ;
}
2026-10-03 08:58:59 +00:00
prop3 = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . guild_scheduled_events_muted !== computeResult1 . guild_scheduled_events_muted ) {
prop3 = computeResult . guild_scheduled_events_muted ;
}
2026-10-03 08:58:59 +00:00
prop4 = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . guild_message_notification_settings !== computeResult1 . guild_message_notification_settings ) {
prop4 = computeResult . guild_message_notification_settings ;
}
2026-10-03 08:58:59 +00:00
trackWithMetadata ( NOTIFICATION_SETTINGS_UPDATED , obj3 ) ;
2026-07-29 08:29:29 +00:00
} ;
export const muteConfigToTimestamp = function muteConfigToTimestamp ( muteConfig ) {
let time = null ;
if ( null != muteConfig ) {
time = null ;
if ( null != muteConfig . end_time ) {
const _Date = Date ;
2026-10-03 08:58:59 +00:00
const self = this ;
const self2 = this ;
2026-07-29 08:29:29 +00:00
const date = new Date ( muteConfig . end_time ) ;
time = date . getTime ( ) ;
}
}
return time ;
2026-07-20 16:05:17 +00:00
} ;
export const trackChannelNotificationSettingsUpdate = function trackChannelNotificationSettingsUpdate ( updateType ) {
2026-10-03 08:58:59 +00:00
let _location ;
let applicationId ;
let change ;
let channel_flags ;
let channel_is_muted ;
let channel_muted_until ;
let label ;
let parent_id ;
let prop ;
let prop1 ;
let time ;
2026-07-20 16:05:17 +00:00
let CHANNEL = updateType . updateType ;
if ( CHANNEL === undefined ) {
CHANNEL = constants2 . CHANNEL ;
}
const guildId = updateType . guildId ;
const channelId = updateType . channelId ;
2026-07-29 08:29:29 +00:00
function compute ( previous , change ) {
2026-10-03 08:58:59 +00:00
let channel_message_notification_settings ;
let flags ;
let time ;
let tmp3 ;
2026-09-10 05:38:07 +00:00
let obj = change ;
2026-07-20 16:05:17 +00:00
if ( change === undefined ) {
obj = { } ;
}
let muted = obj . muted ;
2026-07-29 08:29:29 +00:00
if ( muted == null ) {
2026-07-20 16:05:17 +00:00
let channel_is_muted ;
2026-07-29 08:29:29 +00:00
if ( previous != null ) {
channel_is_muted = previous . channel_is_muted ;
2026-07-20 16:05:17 +00:00
}
muted = channel_is_muted ;
}
if ( null != obj . message_notifications ) {
2026-10-03 08:58:59 +00:00
channel_message_notification_settings = frozen [ obj . message_notifications ] ;
2026-07-29 08:29:29 +00:00
} else if ( previous != null ) {
channel_message_notification_settings = previous . channel_message_notification_settings ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const obj2 = { channel_is_muted : muted , channel_is_overridden : tmp3 , channel_flags : flags , channel_message_notification_settings , channel_muted_until : time } ;
tmp3 = null ;
2026-07-20 16:05:17 +00:00
if ( null != guildId ) {
tmp3 = true === muted || null != channel_message_notification_settings ;
}
2026-10-03 08:58:59 +00:00
flags = obj . flags ;
2026-07-29 08:29:29 +00:00
if ( flags == null ) {
2026-07-20 16:05:17 +00:00
let channel_flags ;
2026-07-29 08:29:29 +00:00
if ( previous != null ) {
channel_flags = previous . channel_flags ;
2026-07-20 16:05:17 +00:00
}
flags = channel_flags ;
}
2026-07-29 08:29:29 +00:00
const mute_config = obj . mute_config ;
2026-10-03 08:58:59 +00:00
time = null ;
2026-07-29 08:29:29 +00:00
if ( null != mute_config ) {
time = null ;
if ( null != mute_config . end_time ) {
const _Date = Date ;
2026-10-03 08:58:59 +00:00
const self = this ;
const self2 = this ;
2026-07-29 08:29:29 +00:00
const date = new Date ( mute_config . end_time ) ;
time = date . getTime ( ) ;
}
}
2026-09-10 05:38:07 +00:00
return obj2 ;
2026-07-20 16:05:17 +00:00
}
( { applicationId , change , label , location : _location } = updateType ) ;
2026-07-29 08:29:29 +00:00
const computeResult = compute ( updateType . previous ) ;
2026-10-03 08:58:59 +00:00
let obj = UserGuildSettingsStore ;
const isChannelMutedResult = UserGuildSettingsStore . isChannelMuted ( guildId , channelId ) ;
2026-09-10 05:38:07 +00:00
const channelMuteConfig = UserGuildSettingsStore . getChannelMuteConfig ( guildId , channelId ) ;
2026-10-03 08:58:59 +00:00
let obj2 = { channel_is_muted : isChannelMutedResult , channel_muted_until : time , channel_message_notification_settings : frozen [ obj . getChannelMessageNotifications ( obj , guildId , channelId ) ] , channel_flags : obj.getChannelIdFlags ( guildId , channelId ) } ;
time = null ;
2026-07-29 08:29:29 +00:00
if ( null != channelMuteConfig ) {
time = null ;
if ( null != channelMuteConfig . end_time ) {
let _Date = Date ;
2026-10-03 08:58:59 +00:00
let self = this ;
let self2 = this ;
2026-07-29 08:29:29 +00:00
let date = new Date ( channelMuteConfig . end_time ) ;
time = date . getTime ( ) ;
}
}
2026-09-10 05:38:07 +00:00
const computeResult1 = compute ( obj2 , change ) ;
const channel = ChannelStore . getChannel ( channelId ) ;
2026-07-29 08:29:29 +00:00
let num ;
if ( computeResult . channel_flags !== computeResult1 . channel_flags ) {
num = computeResult . channel_flags ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( num == null ) {
num = 0 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let num2 = computeResult1 . channel_flags ;
if ( num2 == null ) {
num2 = 0 ;
}
2026-10-03 08:58:59 +00:00
const tmp10 = num2 ^ num ;
2026-10-09 10:00:15 +00:00
const obj4 = guildId ( 1403 ) ;
2026-10-03 08:58:59 +00:00
const removeFlagsResult = obj4 . removeFlags ( tmp10 , constants3 . FAVORITED , constants3 . OPT_IN_ENABLED ) ;
2026-09-10 05:38:07 +00:00
const lastMessage = MessageStore . getLastMessage ( channelId ) ;
2026-07-20 16:05:17 +00:00
let type ;
2026-07-29 08:29:29 +00:00
if ( lastMessage != null ) {
2026-07-20 16:05:17 +00:00
type = lastMessage . type ;
}
2026-07-29 08:29:29 +00:00
if ( type == null ) {
type = null ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const obj3 = { location : _location , guild_id : guildId , channel_id : channelId , update_type : CHANNEL , label , parent_id , channel_flags_old : channel_flags , channel_is_muted_old : channel_is_muted , channel_muted_until_old : channel_muted_until , channel_is_overridden_old : prop , channel_message_notification_settings_old : prop1 , is_opt_in_only_change : 0 === removeFlagsResult , last_message_type : type , application_id : applicationId } ;
const trackWithMetadata = AppAnalyticsUtilsDefault . trackWithMetadata ;
const NOTIFICATION_SETTINGS_UPDATED = constants . NOTIFICATION_SETTINGS_UPDATED ;
AppAnalyticsUtilsDefault ;
2026-07-20 16:05:17 +00:00
const merged = Object . assign ( computeResult1 ) ;
2026-09-10 05:38:07 +00:00
const merged1 = Object . assign ( LastMentionTimestampStore . getStats ( guildId ) ) ;
2026-10-03 08:58:59 +00:00
parent_id = null ;
2026-07-20 16:05:17 +00:00
if ( null != channel ) {
parent_id = channel . parent_id ;
}
2026-10-03 08:58:59 +00:00
channel_flags = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . channel_flags !== computeResult1 . channel_flags ) {
channel_flags = computeResult . channel_flags ;
}
2026-10-03 08:58:59 +00:00
channel_is_muted = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . channel_is_muted !== computeResult1 . channel_is_muted ) {
channel_is_muted = computeResult . channel_is_muted ;
}
2026-10-03 08:58:59 +00:00
channel_muted_until = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . channel_muted_until !== computeResult1 . channel_muted_until ) {
channel_muted_until = computeResult . channel_muted_until ;
}
2026-10-03 08:58:59 +00:00
prop = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . channel_is_overridden !== computeResult1 . channel_is_overridden ) {
prop = computeResult . channel_is_overridden ;
}
2026-10-03 08:58:59 +00:00
prop1 = undefined ;
2026-07-29 08:29:29 +00:00
if ( computeResult . channel_message_notification_settings !== computeResult1 . channel_message_notification_settings ) {
prop1 = computeResult . channel_message_notification_settings ;
}
2026-10-03 08:58:59 +00:00
trackWithMetadata ( NOTIFICATION_SETTINGS_UPDATED , obj3 ) ;
2026-07-29 08:29:29 +00:00
} ;
export const getCurrentGuildSettings = function getCurrentGuildSettings ( guildId ) {
2026-10-03 08:58:59 +00:00
let time ;
const isMutedResult = UserGuildSettingsStore . isMuted ( guildId ) ;
2026-09-10 05:38:07 +00:00
const muteConfig = UserGuildSettingsStore . getMuteConfig ( guildId ) ;
2026-10-03 08:58:59 +00:00
const obj2 = { guild_suppress_everyone : UserGuildSettingsStore.isSuppressEveryoneEnabled ( guildId ) , guild_suppress_roles : UserGuildSettingsStore.isSuppressRolesEnabled ( guildId ) , guild_scheduled_events_muted : UserGuildSettingsStore.isMuteScheduledEventsEnabled ( guildId ) , guild_is_muted : isMutedResult , guild_muted_until : time , guild_receive_mobile_push : UserGuildSettingsStore.isMobilePushEnabled ( guildId ) , guild_message_notification_settings : frozen [ UserGuildSettingsStore . getMessageNotifications ( UserGuildSettingsStore , guildId ) ] , guild_notify_highlights : UserGuildSettingsStore.getNotifyHighlights ( guildId ) , guild_flags : UserGuildSettingsStore.getGuildFlags ( guildId ) } ;
time = null ;
2026-07-29 08:29:29 +00:00
if ( null != muteConfig ) {
time = null ;
if ( null != muteConfig . end_time ) {
const _Date = Date ;
2026-10-03 08:58:59 +00:00
const self = this ;
const self2 = this ;
2026-07-29 08:29:29 +00:00
const date = new Date ( muteConfig . end_time ) ;
time = date . getTime ( ) ;
}
}
2026-09-10 05:38:07 +00:00
return obj2 ;
2026-07-20 16:05:17 +00:00
} ;
export const getManyCurrentGuildSettings = function getManyCurrentGuildSettings ( arr ) {
2026-10-03 08:58:59 +00:00
map = new Map ( ) ;
const item = arr . forEach ( function ( item ) {
let time ;
set = map . set ;
const isMutedResult = UserGuildSettingsStore . isMuted ( item ) ;
2026-09-10 05:38:07 +00:00
const muteConfig = UserGuildSettingsStore . getMuteConfig ( item ) ;
2026-10-03 08:58:59 +00:00
const obj2 = { guild_suppress_everyone : UserGuildSettingsStore.isSuppressEveryoneEnabled ( item ) , guild_suppress_roles : UserGuildSettingsStore.isSuppressRolesEnabled ( item ) , guild_scheduled_events_muted : UserGuildSettingsStore.isMuteScheduledEventsEnabled ( item ) , guild_is_muted : isMutedResult , guild_muted_until : time , guild_receive_mobile_push : UserGuildSettingsStore.isMobilePushEnabled ( item ) , guild_message_notification_settings : frozen [ UserGuildSettingsStore . getMessageNotifications ( UserGuildSettingsStore , item ) ] , guild_notify_highlights : UserGuildSettingsStore.getNotifyHighlights ( item ) , guild_flags : UserGuildSettingsStore.getGuildFlags ( item ) } ;
time = null ;
2026-07-29 08:29:29 +00:00
if ( null != muteConfig ) {
time = null ;
if ( null != muteConfig . end_time ) {
const _Date = Date ;
2026-10-03 08:58:59 +00:00
const self = this ;
const self2 = this ;
2026-07-29 08:29:29 +00:00
const date = new Date ( muteConfig . end_time ) ;
time = date . getTime ( ) ;
}
}
2026-10-03 08:58:59 +00:00
return set ( item , obj2 ) ;
2026-07-29 08:29:29 +00:00
} ) ;
2026-07-20 16:05:17 +00:00
return map ;
} ;
2026-09-23 06:49:31 +00:00
export const getCurrentChannelSettings = function getCurrentChannelSettings ( guildId , channelId ) {
2026-10-03 08:58:59 +00:00
let time ;
const isChannelMutedResult = UserGuildSettingsStore . isChannelMuted ( guildId , channelId ) ;
2026-09-23 06:49:31 +00:00
const channelMuteConfig = UserGuildSettingsStore . getChannelMuteConfig ( guildId , channelId ) ;
2026-10-03 08:58:59 +00:00
const obj2 = { channel_is_muted : isChannelMutedResult , channel_muted_until : time , channel_message_notification_settings : frozen [ UserGuildSettingsStore . getChannelMessageNotifications ( UserGuildSettingsStore , guildId , channelId ) ] , channel_flags : UserGuildSettingsStore.getChannelIdFlags ( guildId , channelId ) } ;
time = null ;
2026-07-29 08:29:29 +00:00
if ( null != channelMuteConfig ) {
time = null ;
if ( null != channelMuteConfig . end_time ) {
const _Date = Date ;
2026-10-03 08:58:59 +00:00
const self = this ;
const self2 = this ;
2026-07-29 08:29:29 +00:00
const date = new Date ( channelMuteConfig . end_time ) ;
time = date . getTime ( ) ;
}
}
2026-09-10 05:38:07 +00:00
return obj2 ;
2026-07-29 08:29:29 +00:00
} ;
2026-07-20 16:05:17 +00:00
export const getManyCurrentChannelSettings = function getManyCurrentChannelSettings ( guildId , keys ) {
2026-10-03 08:58:59 +00:00
let closure_0 = guildId ;
map = new Map ( ) ;
const item = keys . forEach ( function ( item ) {
let time ;
set = map . set ;
const isChannelMutedResult = UserGuildSettingsStore . isChannelMuted ( guildId , item ) ;
const channelMuteConfig = UserGuildSettingsStore . getChannelMuteConfig ( guildId , item ) ;
const obj2 = { channel_is_muted : isChannelMutedResult , channel_muted_until : time , channel_message_notification_settings : frozen [ UserGuildSettingsStore . getChannelMessageNotifications ( UserGuildSettingsStore , guildId , item ) ] , channel_flags : UserGuildSettingsStore.getChannelIdFlags ( guildId , item ) } ;
time = null ;
2026-07-29 08:29:29 +00:00
if ( null != channelMuteConfig ) {
time = null ;
if ( null != channelMuteConfig . end_time ) {
const _Date = Date ;
2026-10-03 08:58:59 +00:00
const self = this ;
const self2 = this ;
2026-07-29 08:29:29 +00:00
const date = new Date ( channelMuteConfig . end_time ) ;
time = date . getTime ( ) ;
}
}
2026-10-03 08:58:59 +00:00
return set ( item , obj2 ) ;
2026-07-29 08:29:29 +00:00
} ) ;
2026-07-20 16:05:17 +00:00
return map ;
} ;
export const trackAccountNotificationSettingUpdated = function trackAccountNotificationSettingUpdated ( quietMode , quietMode2 ) {
2026-10-03 08:58:59 +00:00
const obj = AnalyticsUtilsDefault ;
const obj2 = { update_type : constants2.ACCOUNT , quiet_mode_enabled : quietMode.quietMode , quiet_mode_enabled_old : quietMode2.quietMode } ;
obj . track ( metroImportDefault . NOTIFICATION_SETTINGS_UPDATED , obj2 ) ;
2026-07-20 16:05:17 +00:00
} ;