decord/source/utils/UserSettingsUtils.tsx

104 lines
5.2 KiB
TypeScript
Raw Normal View History

2026-09-03 10:05:34 +00:00
// Module ID: 6252
// Function ID: 6253
2026-07-20 16:05:17 +00:00
// Name: getSanitizedRestrictedGuilds
2026-09-03 10:05:34 +00:00
// Dependencies: [4856, 1908, 673, 4166, 4701, 6253, 1233, 1228, 2]
2026-07-20 16:05:17 +00:00
// Exports: computeFlags, generateNonSpamRetrainingOptInSettingOptions, getSanitizedActivityJoiningRestrictedGuilds, getSanitizedActivityRestrictedGuilds, getSanitizedMessageRequestRestrictedGuilds, getSanitizedRestrictedGuilds, shakeUserSettings, trackUserSettingsPaneViewed
2026-09-03 10:05:34 +00:00
// Module 6252 (getSanitizedRestrictedGuilds)
2026-09-02 09:53:35 +00:00
import ComponentDispatcher from "ComponentDispatcher" /* 1228 */;
import getSystemLocale from "getSystemLocale" /* 1233 */;
2026-09-01 10:26:29 +00:00
import explicitContentFromProto from "explicitContentFromProto" /* 4166 */;
2026-09-03 10:05:34 +00:00
import collectGuildAnalyticsMetadataDefault from "collectGuildAnalyticsMetadata" /* 4701 */;
import getSearchSessionIdDefault from "getSearchSessionId" /* 6253 */;
import closure_3 from "handleConnectionOpen" /* 4856 */;
2026-09-02 09:53:35 +00:00
import closure_4 from "createGuildRecordFromRust" /* 1908 */;
import ME from "ME" /* 673 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
({ AnalyticEvents: c5, FriendSourceFlags: closure_6, AllFriendSourceFlags: error, ComponentActions: closure_8 } = ME);
2026-07-23 10:11:24 +00:00
let obj = { UNDECIDED: 0, [0]: "UNDECIDED", OPTIN: 1, [1]: "OPTIN", OPTOUT: 2, [2]: "OPTOUT" };
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("utils/UserSettingsUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getSanitizedRestrictedGuilds = function getSanitizedRestrictedGuilds() {
2026-08-24 06:08:38 +00:00
const RestrictedGuildIds = explicitContentFromProto.RestrictedGuildIds;
2026-07-20 16:05:17 +00:00
const setting = RestrictedGuildIds.getSetting();
let found = setting;
2026-08-24 06:08:38 +00:00
if (0 === closure_3.totalUnavailableGuilds) {
2026-07-29 08:29:29 +00:00
found = setting.filter((arg0) => null != guild.getGuild(arg0));
2026-07-20 16:05:17 +00:00
}
return new Set(found);
};
export const getSanitizedMessageRequestRestrictedGuilds = function getSanitizedMessageRequestRestrictedGuilds() {
2026-08-24 06:08:38 +00:00
const MessageRequestRestrictedGuildIds = explicitContentFromProto.MessageRequestRestrictedGuildIds;
2026-07-20 16:05:17 +00:00
const setting = MessageRequestRestrictedGuildIds.getSetting();
let found = setting;
2026-08-24 06:08:38 +00:00
if (0 === closure_3.totalUnavailableGuilds) {
2026-07-29 08:29:29 +00:00
found = setting.filter((arg0) => null != guild.getGuild(arg0));
2026-07-20 16:05:17 +00:00
}
return new Set(found);
};
export const getSanitizedActivityRestrictedGuilds = function getSanitizedActivityRestrictedGuilds() {
2026-08-24 06:08:38 +00:00
const ActivityRestrictedGuilds = explicitContentFromProto.ActivityRestrictedGuilds;
2026-07-20 16:05:17 +00:00
const setting = ActivityRestrictedGuilds.getSetting();
let found = setting;
2026-08-24 06:08:38 +00:00
if (0 === closure_3.totalUnavailableGuilds) {
2026-07-29 08:29:29 +00:00
found = setting.filter((arg0) => null != guild.getGuild(arg0));
2026-07-20 16:05:17 +00:00
}
return new Set(found);
};
export const getSanitizedActivityJoiningRestrictedGuilds = function getSanitizedActivityJoiningRestrictedGuilds() {
2026-08-24 06:08:38 +00:00
const ActivityJoiningRestrictedGuilds = explicitContentFromProto.ActivityJoiningRestrictedGuilds;
2026-07-20 16:05:17 +00:00
const setting = ActivityJoiningRestrictedGuilds.getSetting();
let found = setting;
2026-08-24 06:08:38 +00:00
if (0 === closure_3.totalUnavailableGuilds) {
2026-07-29 08:29:29 +00:00
found = setting.filter((arg0) => null != guild.getGuild(arg0));
2026-07-20 16:05:17 +00:00
}
return new Set(found);
};
export const computeFlags = function computeFlags(setting) {
if ((setting & closure_7) === closure_7) {
2026-08-24 06:08:38 +00:00
obj = { all: true, mutualFriends: true, mutualGuilds: true };
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj = { all: false, mutualFriends: null, mutualGuilds: null };
obj[1] = (setting & constants2.MUTUAL_FRIENDS) === constants2.MUTUAL_FRIENDS;
obj[2] = (setting & constants2.MUTUAL_GUILDS) === constants2.MUTUAL_GUILDS;
2026-07-20 16:05:17 +00:00
}
return obj;
};
export const trackUserSettingsPaneViewed = function trackUserSettingsPaneViewed(arg0) {
({ destinationPane, originPane, source, subsection, locationStack, applicationId } = arg0);
2026-08-24 06:08:38 +00:00
obj = collectGuildAnalyticsMetadataDefault;
obj = { settings_type: "user", origin_pane: originPane, destination_pane: destinationPane, location_stack: locationStack, source, subsection, application_id: applicationId, search_session_id: getSearchSessionIdDefault.getSearchSessionId() };
2026-07-20 16:05:17 +00:00
obj.trackWithMetadata(constants.SETTINGS_PANE_VIEWED, obj);
};
export const NonSpamRetrainingOptInOptions = obj;
export const NonSpamRetrainingOptInOptionsToValue = { [obj.UNDECIDED]: undefined, [obj.OPTIN]: true, [obj.OPTOUT]: false };
export const generateNonSpamRetrainingOptInSettingOptions = function generateNonSpamRetrainingOptInSettingOptions() {
2026-08-24 06:08:38 +00:00
obj = { name: null, desc: null, value: null };
const intl = getSystemLocale.intl;
obj[0] = intl.string(getSystemLocale.t["/yLMRQ"]);
const intl2 = getSystemLocale.intl;
obj[1] = intl2.string(getSystemLocale.t["3fzkPq"]);
2026-07-29 08:29:29 +00:00
obj[2] = obj.OPTIN;
2026-07-20 16:05:17 +00:00
const items = [obj, , ];
2026-07-29 08:29:29 +00:00
obj = { name: null, desc: null, value: null };
2026-08-24 06:08:38 +00:00
const intl3 = getSystemLocale.intl;
obj[0] = intl3.string(getSystemLocale.t["21fP2b"]);
const intl4 = getSystemLocale.intl;
obj[1] = intl4.string(getSystemLocale.t.ggJ9jR);
2026-07-29 08:29:29 +00:00
obj[2] = obj.OPTOUT;
2026-07-20 16:05:17 +00:00
items[1] = obj;
2026-07-29 08:29:29 +00:00
obj = { name: null, desc: null, value: null };
2026-08-24 06:08:38 +00:00
const intl5 = getSystemLocale.intl;
obj[0] = intl5.string(getSystemLocale.t.OWIo8w);
const intl6 = getSystemLocale.intl;
obj[1] = intl6.string(getSystemLocale.t.HqYXpw);
2026-07-29 08:29:29 +00:00
obj[2] = obj.UNDECIDED;
2026-07-20 16:05:17 +00:00
items[2] = obj;
return items;
};
export const shakeUserSettings = function shakeUserSettings(arg0) {
2026-08-24 06:08:38 +00:00
const ComponentDispatch = ComponentDispatcher.ComponentDispatch;
2026-07-20 16:05:17 +00:00
ComponentDispatch.dispatch(constants3.SHAKE_SETTINGS_MODAL, arg0);
};