93 lines
3.3 KiB
TypeScript
93 lines
3.3 KiB
TypeScript
// Metro module 5883 (f5884).
|
|
import { useMemo } from "react";
|
|
import UserStore from "../../stores/UserStore";
|
|
import { HelpdeskArticles } from "../../Constants";
|
|
import { ExplicitContentRedaction } from "../../_bundle/Module1306";
|
|
import { isSettingTeenByDefault } from "../regional_feature_config/RegionalFeatureConfigUtils";
|
|
import { SettingsDefaultFeature } from "../../_bundle/Module3875";
|
|
import { GoreContentSettings } from "../user_settings/UserSettings";
|
|
const resolveGoreSettingWithDefaults = function resolveGoreSettingWithDefaults(a0) {
|
|
let r34;
|
|
const setting = a0.setting;
|
|
let isDm = a0.isDm;
|
|
if (isDm === void 0) {
|
|
isDm = false;
|
|
}
|
|
let isFriend = a0.isFriend;
|
|
if (isFriend === void 0) {
|
|
isFriend = false;
|
|
}
|
|
if (setting != null && setting !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION) {
|
|
return setting;
|
|
}
|
|
L43: {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (isSettingTeenByDefault(SettingsDefaultFeature.SENSITIVE_CONTENT)) {
|
|
if (isDm === void 0) {
|
|
isDm = false;
|
|
}
|
|
if (isFriend === void 0) {
|
|
isFriend = false;
|
|
}
|
|
r34 = isDm && !isFriend ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.BLUR;
|
|
} else if (currentUser?.nsfwAllowed === false) {
|
|
const r38 = isDm === void 0 ? false : isDm;
|
|
const r39 = isFriend === void 0 ? false : isFriend;
|
|
r34 = r38 && r39 ? ExplicitContentRedaction.BLUR : r38 ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.BLUR;
|
|
} else {
|
|
const r29 = isDm === void 0 ? false : isDm;
|
|
const r30 = isFriend === void 0 ? false : isFriend;
|
|
if (r29 && r30) {
|
|
r34 = ExplicitContentRedaction.SHOW;
|
|
break L43;
|
|
}
|
|
r34 = r29 ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.SHOW;
|
|
}
|
|
}
|
|
return r34;
|
|
};
|
|
export { resolveGoreSettingWithDefaults };
|
|
export function resolveGoreSettingWithDefaultsForTeen({ isDm = false, isFriend = false }) {
|
|
return isDm && isFriend ? ExplicitContentRedaction.BLUR : isDm ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.BLUR;
|
|
}
|
|
export function getGoreContentSettingOrDefault(a0) {
|
|
const r4 = a0 == null ? GoreContentSettings.getSetting() : a0;
|
|
return {
|
|
goreContentGuilds: resolveGoreSettingWithDefaults({
|
|
setting: r4?.goreContentGuilds
|
|
}),
|
|
goreContentNonFriendDm: resolveGoreSettingWithDefaults({
|
|
setting: r4?.goreContentNonFriendDm,
|
|
isDm: true
|
|
}),
|
|
goreContentFriendDm: resolveGoreSettingWithDefaults({
|
|
setting: r4?.goreContentFriendDm,
|
|
isDm: true,
|
|
isFriend: true
|
|
})
|
|
};
|
|
}
|
|
export function updateGoreContentSetting(a0) {
|
|
const setting = GoreContentSettings.getSetting();
|
|
GoreContentSettings.updateSetting({
|
|
...{
|
|
goreContentGuilds: resolveGoreSettingWithDefaults({
|
|
setting: setting?.goreContentGuilds
|
|
}),
|
|
goreContentNonFriendDm: resolveGoreSettingWithDefaults({
|
|
setting: setting?.goreContentNonFriendDm,
|
|
isDm: true
|
|
}),
|
|
goreContentFriendDm: resolveGoreSettingWithDefaults({
|
|
setting: setting?.goreContentFriendDm,
|
|
isDm: true,
|
|
isFriend: true
|
|
})
|
|
},
|
|
...a0
|
|
});
|
|
}
|
|
export function useSensitiveContentFilterHelpArticle() {
|
|
return useMemo(() => HelpdeskArticles.EXPLICIT_MEDIA_REDACTION, []);
|
|
}
|