decord/source/stores/ChannelSettingsStore.tsx

772 lines
24 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 8168
// Function ID: 8169
2026-07-29 08:29:29 +00:00
// Name: normalizeChannelPropertyForCompare
2026-08-25 06:04:03 +00:00
// Dependencies: [1395, 7905, 1930, 1391, 676, 1235, 4036, 4038, 1400, 1401, 530, 709, 12, 1430, 3979, 589, 2]
2026-07-23 10:11:24 +00:00
2026-08-25 06:04:03 +00:00
// Module 8168 (normalizeChannelPropertyForCompare)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import sendRequest from "sendRequest" /* 530 */;
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import AbortCodes from "AbortCodes" /* 1235 */;
import createChannelRecord from "createChannelRecord" /* 1395 */;
import set2 from "set" /* 1400 */;
import set3 from "set" /* 1401 */;
import fromGuildPropertiesWithAdditionalFields from "fromGuildPropertiesWithAdditionalFields" /* 1430 */;
2026-08-25 06:04:03 +00:00
import hooksDefault from "hooks" /* 3979 */;
import MAX_REACTIONS from "MAX_REACTIONS" /* 4036 */;
import parseRawEmojiObjectDefault from "parseRawEmojiObject" /* 4038 */;
import closure_10 from "createFromServer" /* 7905 */;
2026-08-24 06:08:38 +00:00
import closure_11 from "createdAt" /* 1930 */;
import closure_12 from "ensureGuildLoaded" /* 1391 */;
import ME from "ME" /* 676 */;
import importDefaultResult from "apply" /* 12 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
function normalizeChannelPropertyForCompare(arg0, arg1, arg2) {
let str = arg1;
2026-07-20 16:05:17 +00:00
if ("topic_" === arg0) {
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return str;
2026-07-20 16:05:17 +00:00
} else if ("defaultAutoArchiveDuration" === arg0) {
2026-07-29 08:29:29 +00:00
let tmp21 = str;
if (str == null) {
tmp21 = closure_17;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp21;
2026-07-20 16:05:17 +00:00
} else if ("defaultSortOrder" === arg0) {
2026-07-29 08:29:29 +00:00
let LATEST_ACTIVITY = str;
if (str == null) {
2026-08-24 06:08:38 +00:00
LATEST_ACTIVITY = set2.ThreadSortOrder.LATEST_ACTIVITY;
2026-07-20 16:05:17 +00:00
}
return LATEST_ACTIVITY;
} else if ("defaultForumLayout" === arg0) {
if (arg2 === constants2.GUILD_MEDIA) {
2026-08-24 06:08:38 +00:00
return set3.ForumLayout.GRID;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (null == str) {
2026-08-24 06:08:38 +00:00
let LIST = set3.ForumLayout.LIST;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
LIST = str;
2026-07-20 16:05:17 +00:00
}
return LIST;
}
} else {
if ("rateLimitPerUser_" !== arg0) {
if ("defaultThreadRateLimitPerUser" !== arg0) {
if ("defaultReactionEmoji" === arg0) {
let tmp2 = null;
2026-07-29 08:29:29 +00:00
if (null != str) {
2026-08-24 06:08:38 +00:00
let obj = MAX_REACTIONS;
2026-07-29 08:29:29 +00:00
if (obj.isCustomReactionEmojiId(str.emojiId)) {
obj = { emojiId: null };
obj[0] = str.emojiId;
2026-07-20 16:05:17 +00:00
tmp2 = obj;
} else {
2026-07-29 08:29:29 +00:00
const emojiName = str.emojiName;
2026-07-20 16:05:17 +00:00
let tmp5 = null;
if (null != emojiName) {
tmp5 = null;
if ("" !== emojiName) {
2026-07-29 08:29:29 +00:00
obj = { emojiName: null };
2026-08-24 06:08:38 +00:00
obj[0] = parseRawEmojiObjectDefault.translateInlineEmojiToSurrogates(emojiName);
2026-07-20 16:05:17 +00:00
tmp5 = obj;
2026-08-24 06:08:38 +00:00
const obj3 = parseRawEmojiObjectDefault;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = tmp5;
}
}
return tmp2;
} else {
2026-07-29 08:29:29 +00:00
return str;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
let num = str;
if (str == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return num;
2026-07-20 16:05:17 +00:00
}
}
function _createInvite(code) {
2026-07-29 08:29:29 +00:00
const obj = { code: code.code, temporary: code.temporary, revoked: code.revoked, inviter: null, channel: null, guild: null, uses: null, maxUses: null, maxAge: null, createdAt: null, type: null, roles: null };
2026-07-20 16:05:17 +00:00
let tmp2 = null;
2026-08-24 06:08:38 +00:00
let tmp = closure_10;
2026-07-20 16:05:17 +00:00
if (null != code.inviter) {
2026-08-24 06:08:38 +00:00
tmp2 = new closure_11(code.inviter);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = tmp2;
obj[4] = callback(code.channel);
2026-07-20 16:05:17 +00:00
let fromInviteGuildResult = null;
if (null != code.guild) {
2026-08-24 06:08:38 +00:00
fromInviteGuildResult = fromGuildPropertiesWithAdditionalFields.fromInviteGuild(code.guild);
const obj2 = fromGuildPropertiesWithAdditionalFields;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[5] = fromInviteGuildResult;
({ uses: obj[6], max_uses: obj[7], max_age: obj[8] } = code);
2026-08-25 06:04:03 +00:00
obj[9] = hooksDefault(code.created_at);
2026-07-29 08:29:29 +00:00
({ type: obj[10], roles: obj[11] } = code);
2026-07-20 16:05:17 +00:00
tmp = new tmp(obj);
return tmp;
}
2026-07-23 10:11:24 +00:00
function _syncChannelUpdate(id) {
2026-07-20 16:05:17 +00:00
let flag = false;
if (null != channel1) {
flag = false;
2026-07-23 10:11:24 +00:00
if (channel1.id === id) {
2026-07-29 08:29:29 +00:00
if (channel1 === store) {
const channel = store2.getChannel(id);
2026-07-20 16:05:17 +00:00
flag = false;
if (null != channel) {
2026-07-23 10:11:24 +00:00
channel1 = channel;
2026-07-29 08:29:29 +00:00
store = channel;
let channel2 = obj2.getChannel(store.parent_id);
2026-07-20 16:05:17 +00:00
flag = true;
}
2026-07-29 08:29:29 +00:00
obj2 = store2;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
channel1 = store2.getChannel(id);
2026-07-20 16:05:17 +00:00
flag = false;
if (null != channel1) {
flag = true;
2026-07-29 08:29:29 +00:00
if (null != store) {
const result = store.set("permissionOverwrites", channel1.permissionOverwrites);
store = result.set("availableTags", channel1.availableTags);
channel2 = obj3.getChannel(store.parent_id);
2026-07-20 16:05:17 +00:00
flag = true;
}
}
2026-07-29 08:29:29 +00:00
obj3 = store2;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
let tmp10 = !flag;
2026-07-20 16:05:17 +00:00
if (flag) {
2026-07-29 08:29:29 +00:00
tmp10 = null == store;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let flag2 = !tmp10;
if (!tmp10) {
let tmp13 = null != guildId;
if (tmp13) {
tmp13 = null == store.permissionOverwrites[guildId];
2026-07-20 16:05:17 +00:00
}
flag2 = true;
2026-07-29 08:29:29 +00:00
if (tmp13) {
guildId = store.getGuildId();
2026-07-20 16:05:17 +00:00
flag2 = true;
}
}
return flag2;
}
function handleOverwriteUpdate(channelId) {
return _syncChannelUpdate(channelId.channelId);
}
2026-08-24 06:08:38 +00:00
let closure_9 = createChannelRecord.createChannelRecordFromInvite;
2026-07-29 08:29:29 +00:00
({ ChannelSettingsSections: map1, ChannelTypes: closure_14, Endpoints: closure_15, FormStates } = ME);
2026-08-24 06:08:38 +00:00
let closure_17 = AbortCodes.DEFAULT_AUTO_ARCHIVE_DURATION;
2026-07-23 10:11:24 +00:00
let CLOSED = FormStates.CLOSED;
2026-07-29 08:29:29 +00:00
let closure_19 = {};
let closure_20 = {};
let c21 = false;
let c22 = false;
let c23 = null;
let closure_24 = ["name", "type", "topic_", "bitrate_", "userLimit_", "nsfw_", "flags_", "rateLimitPerUser_", "defaultThreadRateLimitPerUser", "defaultAutoArchiveDuration", "template", "defaultReactionEmoji", "rtcRegion", "videoQualityMode", "threadMetadata", "banner", "availableTags", "defaultSortOrder", "defaultForumLayout", "defaultTagSetting", "iconEmoji", "themeColor"];
2026-08-24 06:08:38 +00:00
let closure_26 = importDefaultResult.debounce(() => {
2026-07-29 08:29:29 +00:00
if (null != store) {
if (null != closure_5) {
const toJSResult = store.toJS();
2026-08-24 06:08:38 +00:00
require = toJSResult;
closure_1 = closure_5.toJS();
2026-07-23 10:11:24 +00:00
const type = toJSResult.type;
2026-07-29 08:29:29 +00:00
let everyResult = closure_24.every((arg0) => {
2026-08-24 06:08:38 +00:00
const tmp = closure_1_25(arg0, toJSResult[arg0], type);
const tmp2 = closure_1_25(arg0, dependencyMap[arg0], type);
2026-07-29 08:29:29 +00:00
return dependencyMap(type[12]).isEqual(tmp, tmp2);
2026-07-20 16:05:17 +00:00
});
if (everyResult) {
2026-07-29 08:29:29 +00:00
everyResult = store !== closure_5;
2026-07-20 16:05:17 +00:00
}
if (everyResult) {
2026-07-29 08:29:29 +00:00
store = closure_5;
channelSettingsStore.emitChange();
2026-07-20 16:05:17 +00:00
}
}
}
return false;
}, 500);
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class ChannelSettingsStore extends Store {
}
const prototype = ChannelSettingsStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_12);
2026-07-29 08:29:29 +00:00
};
prototype["hasChanges"] = function hasChanges() {
return closure_6 !== closure_5;
};
prototype["isOpen"] = function isOpen() {
return c22;
};
prototype["getSection"] = function getSection() {
return closure_3;
};
prototype["getInvites"] = function getInvites() {
return { invites: closure_20, loading: c21 };
};
prototype["showNotice"] = function showNotice() {
return this.hasChanges();
};
prototype["getChannel"] = function getChannel() {
return closure_6;
};
prototype["getFormState"] = function getFormState() {
return CLOSED;
};
prototype["getCategory"] = function getCategory() {
return closure_7;
};
prototype["getProps"] = function getProps() {
return { submitting: CLOSED === FormStates.SUBMITTING, errors: closure_19, channel: closure_6, section: closure_3, subsection: closure_4, invites: closure_20, selectedOverwriteId: closure_8, hasChanges: this.hasChanges(), analyticsLocation: c23 };
};
ChannelSettingsStore.displayName = "ChannelSettingsStore";
2026-08-24 06:08:38 +00:00
const channelSettingsStore = new ChannelSettingsStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
CHANNEL_SETTINGS_INIT: function handleSettingsInit(channelId) {
2026-07-29 08:29:29 +00:00
let obj = store2;
let channel = store2.getChannel(channelId.channelId);
2026-07-20 16:05:17 +00:00
if (null == channel) {
2026-08-24 06:08:38 +00:00
c22 = false;
2026-07-29 08:29:29 +00:00
let OPEN = FormStates.CLOSED;
2026-08-24 06:08:38 +00:00
let OVERVIEW = null;
2026-07-29 08:29:29 +00:00
channel = null;
let store = null;
let channel2 = null;
2026-08-24 06:08:38 +00:00
closure_20 = {};
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
OPEN = FormStates.OPEN;
store = channel;
2026-07-20 16:05:17 +00:00
let _location = null;
if ("location" in channelId) {
_location = null;
if (null != channelId.location) {
_location = channelId.location;
}
}
let subsection = null;
if ("subsection" in channelId) {
subsection = channelId.subsection;
}
2026-08-24 06:08:38 +00:00
closure_4 = subsection;
2026-07-29 08:29:29 +00:00
if (null != store) {
store = store.set("nsfw", store.isNSFW());
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
channel2 = obj.getChannel(store.parent_id);
const guildId = store.getGuildId();
if (store.isModeratorReportChannel()) {
2026-08-24 06:08:38 +00:00
OVERVIEW = tmp10.PERMISSIONS;
2026-07-29 08:29:29 +00:00
let tmp11 = tmp10;
} else {
OVERVIEW = tmp10.OVERVIEW;
tmp11 = tmp10;
}
2026-08-24 06:08:38 +00:00
closure_19 = {};
let tmp12 = OVERVIEW;
if (OVERVIEW == null) {
2026-07-29 08:29:29 +00:00
tmp12 = OVERVIEW;
}
2026-08-24 06:08:38 +00:00
OVERVIEW = tmp12;
2026-07-29 08:29:29 +00:00
let tmp15 = null != store;
if (tmp15) {
2026-08-24 06:08:38 +00:00
tmp15 = OVERVIEW === tmp11.INSTANT_INVITES;
2026-07-29 08:29:29 +00:00
}
if (tmp15) {
2026-08-24 06:08:38 +00:00
c21 = true;
const HTTP = sendRequest.HTTP;
2026-07-29 08:29:29 +00:00
obj = { url: null, oldFormErrors: true, rejectWithError: true };
obj[0] = closure_15.INSTANT_INVITES(store.id);
const value = HTTP.get(obj);
value.then((body) => {
2026-08-24 06:08:38 +00:00
c21 = false;
2026-07-29 08:29:29 +00:00
let obj = callback(table[11]);
obj = { type: "CHANNEL_SETTINGS_LOADED_INVITES", invites: body.body };
obj.dispatch(obj);
}, () => {
2026-08-24 06:08:38 +00:00
c21 = false;
2026-07-29 08:29:29 +00:00
return false;
});
2026-07-20 16:05:17 +00:00
}
return true;
}
},
CHANNEL_SETTINGS_SUBMIT: function handleSettingsSubmit() {
2026-07-23 10:11:24 +00:00
const SUBMITTING = FormStates.SUBMITTING;
2026-08-24 06:08:38 +00:00
closure_19 = {};
2026-07-20 16:05:17 +00:00
},
CHANNEL_SETTINGS_SUBMIT_SUCCESS: function handleSettingsSubmitSuccess() {
2026-08-24 06:08:38 +00:00
closure_5 = closure_6;
2026-07-23 10:11:24 +00:00
const OPEN = FormStates.OPEN;
2026-07-20 16:05:17 +00:00
},
CHANNEL_SETTINGS_SUBMIT_FAILURE: function handleSettingsSubmitFailure(errors) {
2026-08-24 06:08:38 +00:00
closure_0 = errors;
2026-07-23 10:11:24 +00:00
const OPEN = FormStates.OPEN;
2026-07-20 16:05:17 +00:00
errors = errors.errors;
2026-07-29 08:29:29 +00:00
if (errors == null) {
2026-07-20 16:05:17 +00:00
errors = {};
}
const keys = Object.keys(errors);
2026-08-24 06:08:38 +00:00
closure_19 = keys.reduce((arg0, arg1) => {
2026-07-23 10:11:24 +00:00
if (obj2.isArray(errors.errors[arg1])) {
2026-07-20 16:05:17 +00:00
arg0[arg1] = obj.join("\n");
} else {
arg0[arg1] = obj;
}
return arg0;
}, {});
},
2026-07-29 08:29:29 +00:00
CHANNEL_SETTINGS_CLOSE: function handleSettingsClose() {
2026-08-24 06:08:38 +00:00
c22 = false;
CLOSED = FormStates.CLOSED;
c3 = null;
c5 = null;
c6 = null;
c7 = null;
closure_20 = {};
2026-07-29 08:29:29 +00:00
},
2026-07-20 16:05:17 +00:00
CHANNEL_PERMISSIONS_PUT_OVERWRITE_SUCCESS: handleOverwriteUpdate,
CHANNEL_PERMISSIONS_DELETE_OVERWRITE_SUCCESS: handleOverwriteUpdate,
CHANNEL_SETTINGS_OVERWRITE_SELECT: function handlePermissionOverwriteSelect(overwriteId) {
overwriteId = overwriteId.overwriteId;
},
CHANNEL_SETTINGS_UPDATE: function handleSettingsUpdate(arg0) {
({ name, channelType, topic, bitrate, userLimit, nsfw, flags, rateLimitPerUser, defaultThreadRateLimitPerUser, autoArchiveDuration, locked, invitable, defaultAutoArchiveDuration, template, defaultReactionEmoji, rtcRegion, videoQualityMode, availableTags, defaultSortOrder, defaultForumLayout, defaultTagSetting, iconEmoji, themeColor } = arg0);
2026-07-29 08:29:29 +00:00
if (null == store) {
2026-07-20 16:05:17 +00:00
return false;
} else {
if (null != name) {
2026-07-29 08:29:29 +00:00
store = store.set("name", name);
2026-07-20 16:05:17 +00:00
}
if (null != topic) {
2026-07-29 08:29:29 +00:00
store = store.set("topic", topic);
2026-07-20 16:05:17 +00:00
}
if (null != bitrate) {
2026-07-29 08:29:29 +00:00
store = store.set("bitrate", bitrate);
2026-07-20 16:05:17 +00:00
}
if (null != userLimit) {
2026-07-29 08:29:29 +00:00
store = store.set("userLimit", userLimit);
2026-07-20 16:05:17 +00:00
}
if (null != nsfw) {
2026-07-29 08:29:29 +00:00
store = store.set("nsfw", nsfw);
2026-07-20 16:05:17 +00:00
}
if (null != flags) {
2026-07-29 08:29:29 +00:00
store = store.set("flags", flags);
2026-07-20 16:05:17 +00:00
}
if (null != rateLimitPerUser) {
2026-07-29 08:29:29 +00:00
store = store.set("rateLimitPerUser", rateLimitPerUser);
2026-07-20 16:05:17 +00:00
}
if (null != defaultThreadRateLimitPerUser) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultThreadRateLimitPerUser", defaultThreadRateLimitPerUser);
2026-07-20 16:05:17 +00:00
}
if (null != autoArchiveDuration) {
let obj = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(store.threadMetadata);
obj.autoArchiveDuration = autoArchiveDuration;
store = store.set("threadMetadata", obj);
2026-07-20 16:05:17 +00:00
}
if (null != locked) {
obj = {};
2026-07-29 08:29:29 +00:00
const merged1 = Object.assign(store.threadMetadata);
obj.locked = locked;
store = store.set("threadMetadata", obj);
2026-07-20 16:05:17 +00:00
}
if (null != invitable) {
obj = {};
2026-07-29 08:29:29 +00:00
const merged2 = Object.assign(store.threadMetadata);
obj.invitable = invitable;
store = store.set("threadMetadata", obj);
2026-07-20 16:05:17 +00:00
}
if (null != defaultAutoArchiveDuration) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultAutoArchiveDuration", defaultAutoArchiveDuration);
2026-07-20 16:05:17 +00:00
}
if (null != template) {
2026-07-29 08:29:29 +00:00
store = store.set("template", template);
2026-07-20 16:05:17 +00:00
}
if (null != channelType) {
2026-07-29 08:29:29 +00:00
store = store.set("type", channelType);
2026-07-20 16:05:17 +00:00
}
if (undefined !== rtcRegion) {
2026-07-29 08:29:29 +00:00
store = store.set("rtcRegion", rtcRegion);
2026-07-20 16:05:17 +00:00
}
if (null != videoQualityMode) {
2026-07-29 08:29:29 +00:00
store = store.set("videoQualityMode", videoQualityMode);
2026-07-20 16:05:17 +00:00
}
if (undefined !== defaultReactionEmoji) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultReactionEmoji", defaultReactionEmoji);
2026-07-20 16:05:17 +00:00
}
if (null != availableTags) {
2026-07-29 08:29:29 +00:00
store = store.set("availableTags", availableTags);
2026-07-20 16:05:17 +00:00
}
if (null != defaultSortOrder) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultSortOrder", defaultSortOrder);
2026-07-20 16:05:17 +00:00
}
if (null != defaultTagSetting) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultTagSetting", defaultTagSetting);
2026-07-20 16:05:17 +00:00
}
if (null != defaultForumLayout) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultForumLayout", defaultForumLayout);
2026-07-20 16:05:17 +00:00
}
if (undefined !== iconEmoji) {
2026-07-29 08:29:29 +00:00
store = store.set("iconEmoji", iconEmoji);
2026-07-20 16:05:17 +00:00
}
if (null != themeColor) {
2026-07-29 08:29:29 +00:00
store = store.set("themeColor", themeColor);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
callback2();
}
},
CHANNEL_SETTINGS_SET_SECTION: function handleSetSection(arg0) {
({ section: closure_3, subsection: closure_4 } = arg0);
let tmp = null != store;
if (tmp) {
tmp = closure_3 === constants.INSTANT_INVITES;
}
if (tmp) {
2026-08-24 06:08:38 +00:00
c21 = true;
const HTTP = sendRequest.HTTP;
2026-07-29 08:29:29 +00:00
const obj = { url: null, oldFormErrors: true, rejectWithError: true };
obj[0] = closure_15.INSTANT_INVITES(store.id);
const value = HTTP.get(obj);
value.then((body) => {
2026-08-24 06:08:38 +00:00
c21 = false;
2026-07-29 08:29:29 +00:00
let obj = callback(table[11]);
obj = { type: "CHANNEL_SETTINGS_LOADED_INVITES", invites: body.body };
obj.dispatch(obj);
}, () => {
2026-08-24 06:08:38 +00:00
c21 = false;
2026-07-29 08:29:29 +00:00
return false;
});
2026-07-20 16:05:17 +00:00
}
},
CHANNEL_SETTINGS_LOADED_INVITES: function handleLoadedInvites(invites) {
2026-08-24 06:08:38 +00:00
closure_20 = {};
2026-07-20 16:05:17 +00:00
invites = invites.invites;
const item = invites.forEach((code) => {
2026-07-29 08:29:29 +00:00
closure_20[code.code] = callback(code);
2026-07-20 16:05:17 +00:00
});
},
2026-07-29 08:29:29 +00:00
CHANNEL_UPDATES: function handleChannelUpdates(channels) {
channels = channels.channels;
if (null == closure_6) {
2026-07-20 16:05:17 +00:00
return false;
} else {
let flag = false;
2026-07-29 08:29:29 +00:00
const tmp2 = channels[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp6 = _syncChannelUpdate;
let tmp7 = _syncChannelUpdate(tmp4.id) || flag;
flag = tmp7;
continue;
}
return flag;
2026-07-20 16:05:17 +00:00
}
},
THREAD_UPDATE: function handleThreadUpdate(arg0) {
2026-07-29 08:29:29 +00:00
let tmp2 = null != closure_6;
2026-07-20 16:05:17 +00:00
if (tmp2) {
tmp2 = _syncChannelUpdate(tmp.id);
}
return tmp2;
},
CHANNEL_DELETE: function handleChannelDelete(arg0) {
2026-07-29 08:29:29 +00:00
let tmp2 = null != store;
2026-07-20 16:05:17 +00:00
if (tmp2) {
2026-07-29 08:29:29 +00:00
if (store.id === tmp) {
2026-08-24 06:08:38 +00:00
CLOSED = FormStates.CLOSED;
2026-07-20 16:05:17 +00:00
}
tmp2 = tmp4;
}
return tmp2;
},
INSTANT_INVITE_REVOKE_SUCCESS: function handleInviteRevoke(arg0) {
2026-07-23 10:11:24 +00:00
const obj = {};
const merged = Object.assign(obj);
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
},
INSTANT_INVITE_CREATE_SUCCESS: function handleInviteCreateSuccess(invite) {
const obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(obj);
2026-07-20 16:05:17 +00:00
obj[invite.invite.code] = _createInvite(invite.invite);
}
});
2026-07-23 10:11:24 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
CHANNEL_SETTINGS_INIT: function handleSettingsInit(channelId) {
2026-07-29 08:29:29 +00:00
let obj = store2;
let channel = store2.getChannel(channelId.channelId);
2026-07-20 16:05:17 +00:00
if (null == channel) {
2026-08-24 06:08:38 +00:00
c22 = false;
2026-07-29 08:29:29 +00:00
let OPEN = FormStates.CLOSED;
2026-08-24 06:08:38 +00:00
let OVERVIEW = null;
2026-07-29 08:29:29 +00:00
channel = null;
let store = null;
let channel2 = null;
2026-08-24 06:08:38 +00:00
closure_20 = {};
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
OPEN = FormStates.OPEN;
store = channel;
2026-07-20 16:05:17 +00:00
let _location = null;
if ("location" in channelId) {
_location = null;
if (null != channelId.location) {
_location = channelId.location;
}
}
let subsection = null;
if ("subsection" in channelId) {
subsection = channelId.subsection;
}
2026-08-24 06:08:38 +00:00
closure_4 = subsection;
2026-07-29 08:29:29 +00:00
if (null != store) {
store = store.set("nsfw", store.isNSFW());
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
channel2 = obj.getChannel(store.parent_id);
const guildId = store.getGuildId();
if (store.isModeratorReportChannel()) {
2026-08-24 06:08:38 +00:00
OVERVIEW = tmp10.PERMISSIONS;
2026-07-29 08:29:29 +00:00
let tmp11 = tmp10;
} else {
OVERVIEW = tmp10.OVERVIEW;
tmp11 = tmp10;
}
2026-08-24 06:08:38 +00:00
closure_19 = {};
let tmp12 = OVERVIEW;
if (OVERVIEW == null) {
2026-07-29 08:29:29 +00:00
tmp12 = OVERVIEW;
}
2026-08-24 06:08:38 +00:00
OVERVIEW = tmp12;
2026-07-29 08:29:29 +00:00
let tmp15 = null != store;
if (tmp15) {
2026-08-24 06:08:38 +00:00
tmp15 = OVERVIEW === tmp11.INSTANT_INVITES;
2026-07-29 08:29:29 +00:00
}
if (tmp15) {
2026-08-24 06:08:38 +00:00
c21 = true;
const HTTP = sendRequest.HTTP;
2026-07-29 08:29:29 +00:00
obj = { url: null, oldFormErrors: true, rejectWithError: true };
obj[0] = closure_15.INSTANT_INVITES(store.id);
const value = HTTP.get(obj);
value.then((body) => {
2026-08-24 06:08:38 +00:00
c21 = false;
2026-07-29 08:29:29 +00:00
let obj = callback(table[11]);
obj = { type: "CHANNEL_SETTINGS_LOADED_INVITES", invites: body.body };
obj.dispatch(obj);
}, () => {
2026-08-24 06:08:38 +00:00
c21 = false;
2026-07-29 08:29:29 +00:00
return false;
});
2026-07-20 16:05:17 +00:00
}
return true;
}
},
CHANNEL_SETTINGS_SUBMIT: function handleSettingsSubmit() {
2026-07-23 10:11:24 +00:00
const SUBMITTING = FormStates.SUBMITTING;
2026-08-24 06:08:38 +00:00
closure_19 = {};
2026-07-20 16:05:17 +00:00
},
CHANNEL_SETTINGS_SUBMIT_SUCCESS: function handleSettingsSubmitSuccess() {
2026-08-24 06:08:38 +00:00
closure_5 = closure_6;
2026-07-23 10:11:24 +00:00
const OPEN = FormStates.OPEN;
2026-07-20 16:05:17 +00:00
},
CHANNEL_SETTINGS_SUBMIT_FAILURE: function handleSettingsSubmitFailure(errors) {
2026-08-24 06:08:38 +00:00
closure_0 = errors;
2026-07-23 10:11:24 +00:00
const OPEN = FormStates.OPEN;
2026-07-20 16:05:17 +00:00
errors = errors.errors;
2026-07-29 08:29:29 +00:00
if (errors == null) {
2026-07-20 16:05:17 +00:00
errors = {};
}
const keys = Object.keys(errors);
2026-08-24 06:08:38 +00:00
closure_19 = keys.reduce((arg0, arg1) => {
2026-07-23 10:11:24 +00:00
if (obj2.isArray(errors.errors[arg1])) {
2026-07-20 16:05:17 +00:00
arg0[arg1] = obj.join("\n");
} else {
arg0[arg1] = obj;
}
return arg0;
}, {});
},
2026-07-29 08:29:29 +00:00
CHANNEL_SETTINGS_CLOSE: function handleSettingsClose() {
2026-08-24 06:08:38 +00:00
c22 = false;
CLOSED = FormStates.CLOSED;
c3 = null;
c5 = null;
c6 = null;
c7 = null;
closure_20 = {};
2026-07-29 08:29:29 +00:00
},
2026-07-20 16:05:17 +00:00
CHANNEL_PERMISSIONS_PUT_OVERWRITE_SUCCESS: handleOverwriteUpdate,
CHANNEL_PERMISSIONS_DELETE_OVERWRITE_SUCCESS: handleOverwriteUpdate,
CHANNEL_SETTINGS_OVERWRITE_SELECT: function handlePermissionOverwriteSelect(overwriteId) {
overwriteId = overwriteId.overwriteId;
},
CHANNEL_SETTINGS_UPDATE: function handleSettingsUpdate(arg0) {
({ name, channelType, topic, bitrate, userLimit, nsfw, flags, rateLimitPerUser, defaultThreadRateLimitPerUser, autoArchiveDuration, locked, invitable, defaultAutoArchiveDuration, template, defaultReactionEmoji, rtcRegion, videoQualityMode, availableTags, defaultSortOrder, defaultForumLayout, defaultTagSetting, iconEmoji, themeColor } = arg0);
2026-07-29 08:29:29 +00:00
if (null == store) {
2026-07-20 16:05:17 +00:00
return false;
} else {
if (null != name) {
2026-07-29 08:29:29 +00:00
store = store.set("name", name);
2026-07-20 16:05:17 +00:00
}
if (null != topic) {
2026-07-29 08:29:29 +00:00
store = store.set("topic", topic);
2026-07-20 16:05:17 +00:00
}
if (null != bitrate) {
2026-07-29 08:29:29 +00:00
store = store.set("bitrate", bitrate);
2026-07-20 16:05:17 +00:00
}
if (null != userLimit) {
2026-07-29 08:29:29 +00:00
store = store.set("userLimit", userLimit);
2026-07-20 16:05:17 +00:00
}
if (null != nsfw) {
2026-07-29 08:29:29 +00:00
store = store.set("nsfw", nsfw);
2026-07-20 16:05:17 +00:00
}
if (null != flags) {
2026-07-29 08:29:29 +00:00
store = store.set("flags", flags);
2026-07-20 16:05:17 +00:00
}
if (null != rateLimitPerUser) {
2026-07-29 08:29:29 +00:00
store = store.set("rateLimitPerUser", rateLimitPerUser);
2026-07-20 16:05:17 +00:00
}
if (null != defaultThreadRateLimitPerUser) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultThreadRateLimitPerUser", defaultThreadRateLimitPerUser);
2026-07-20 16:05:17 +00:00
}
if (null != autoArchiveDuration) {
let obj = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(store.threadMetadata);
obj.autoArchiveDuration = autoArchiveDuration;
store = store.set("threadMetadata", obj);
2026-07-20 16:05:17 +00:00
}
if (null != locked) {
obj = {};
2026-07-29 08:29:29 +00:00
const merged1 = Object.assign(store.threadMetadata);
obj.locked = locked;
store = store.set("threadMetadata", obj);
2026-07-20 16:05:17 +00:00
}
if (null != invitable) {
obj = {};
2026-07-29 08:29:29 +00:00
const merged2 = Object.assign(store.threadMetadata);
obj.invitable = invitable;
store = store.set("threadMetadata", obj);
2026-07-20 16:05:17 +00:00
}
if (null != defaultAutoArchiveDuration) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultAutoArchiveDuration", defaultAutoArchiveDuration);
2026-07-20 16:05:17 +00:00
}
if (null != template) {
2026-07-29 08:29:29 +00:00
store = store.set("template", template);
2026-07-20 16:05:17 +00:00
}
if (null != channelType) {
2026-07-29 08:29:29 +00:00
store = store.set("type", channelType);
2026-07-20 16:05:17 +00:00
}
if (undefined !== rtcRegion) {
2026-07-29 08:29:29 +00:00
store = store.set("rtcRegion", rtcRegion);
2026-07-20 16:05:17 +00:00
}
if (null != videoQualityMode) {
2026-07-29 08:29:29 +00:00
store = store.set("videoQualityMode", videoQualityMode);
2026-07-20 16:05:17 +00:00
}
if (undefined !== defaultReactionEmoji) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultReactionEmoji", defaultReactionEmoji);
2026-07-20 16:05:17 +00:00
}
if (null != availableTags) {
2026-07-29 08:29:29 +00:00
store = store.set("availableTags", availableTags);
2026-07-20 16:05:17 +00:00
}
if (null != defaultSortOrder) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultSortOrder", defaultSortOrder);
2026-07-20 16:05:17 +00:00
}
if (null != defaultTagSetting) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultTagSetting", defaultTagSetting);
2026-07-20 16:05:17 +00:00
}
if (null != defaultForumLayout) {
2026-07-29 08:29:29 +00:00
store = store.set("defaultForumLayout", defaultForumLayout);
2026-07-20 16:05:17 +00:00
}
if (undefined !== iconEmoji) {
2026-07-29 08:29:29 +00:00
store = store.set("iconEmoji", iconEmoji);
2026-07-20 16:05:17 +00:00
}
if (null != themeColor) {
2026-07-29 08:29:29 +00:00
store = store.set("themeColor", themeColor);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
callback2();
}
},
CHANNEL_SETTINGS_SET_SECTION: function handleSetSection(arg0) {
({ section: closure_3, subsection: closure_4 } = arg0);
let tmp = null != store;
if (tmp) {
tmp = closure_3 === constants.INSTANT_INVITES;
}
if (tmp) {
2026-08-24 06:08:38 +00:00
c21 = true;
const HTTP = sendRequest.HTTP;
2026-07-29 08:29:29 +00:00
const obj = { url: null, oldFormErrors: true, rejectWithError: true };
obj[0] = closure_15.INSTANT_INVITES(store.id);
const value = HTTP.get(obj);
value.then((body) => {
2026-08-24 06:08:38 +00:00
c21 = false;
2026-07-29 08:29:29 +00:00
let obj = callback(table[11]);
obj = { type: "CHANNEL_SETTINGS_LOADED_INVITES", invites: body.body };
obj.dispatch(obj);
}, () => {
2026-08-24 06:08:38 +00:00
c21 = false;
2026-07-29 08:29:29 +00:00
return false;
});
2026-07-20 16:05:17 +00:00
}
},
CHANNEL_SETTINGS_LOADED_INVITES: function handleLoadedInvites(invites) {
2026-08-24 06:08:38 +00:00
closure_20 = {};
2026-07-20 16:05:17 +00:00
invites = invites.invites;
const item = invites.forEach((code) => {
2026-07-29 08:29:29 +00:00
closure_20[code.code] = callback(code);
2026-07-20 16:05:17 +00:00
});
},
2026-07-29 08:29:29 +00:00
CHANNEL_UPDATES: function handleChannelUpdates(channels) {
channels = channels.channels;
if (null == closure_6) {
2026-07-20 16:05:17 +00:00
return false;
} else {
let flag = false;
2026-07-29 08:29:29 +00:00
const tmp2 = channels[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp6 = _syncChannelUpdate;
let tmp7 = _syncChannelUpdate(tmp4.id) || flag;
flag = tmp7;
continue;
}
return flag;
2026-07-20 16:05:17 +00:00
}
},
THREAD_UPDATE: function handleThreadUpdate(arg0) {
2026-07-29 08:29:29 +00:00
let tmp2 = null != closure_6;
2026-07-20 16:05:17 +00:00
if (tmp2) {
tmp2 = _syncChannelUpdate(tmp.id);
}
return tmp2;
},
CHANNEL_DELETE: function handleChannelDelete(arg0) {
2026-07-29 08:29:29 +00:00
let tmp2 = null != store;
2026-07-20 16:05:17 +00:00
if (tmp2) {
2026-07-29 08:29:29 +00:00
if (store.id === tmp) {
2026-08-24 06:08:38 +00:00
CLOSED = FormStates.CLOSED;
2026-07-20 16:05:17 +00:00
}
tmp2 = tmp4;
}
return tmp2;
},
INSTANT_INVITE_REVOKE_SUCCESS: function handleInviteRevoke(arg0) {
2026-07-23 10:11:24 +00:00
const obj = {};
const merged = Object.assign(obj);
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
},
INSTANT_INVITE_CREATE_SUCCESS: function handleInviteCreateSuccess(invite) {
const obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(obj);
2026-07-20 16:05:17 +00:00
obj[invite.invite.code] = _createInvite(invite.invite);
}
};
2026-08-24 06:08:38 +00:00
let result = set.fileFinishedImporting("stores/ChannelSettingsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default channelSettingsStore;