decord/alpha/source/stores/ChannelSettingsPermissionsStore.tsx

303 lines
8.7 KiB
TypeScript
Raw Normal View History

// Module ID: 17302
// Function ID: 17303
// Name: ChannelSettingsPermissionsStore
// Dependencies: [4984, 8909, 2042, 1074, 8676, 510, 4401, 11865, 12, 504, 573, 2]
2026-07-23 10:11:24 +00:00
// Module 17302 (ChannelSettingsPermissionsStore)
import _modDef12 from "module_12" /* 12 */;
import initializeDefault from "initialize" /* 504 */;
import Storage2 from "Storage" /* 510 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import PermissionUtilsAll from "PermissionUtils" /* 4401 */;
import AppChannelPermissionUtils from "AppChannelPermissionUtils" /* 11865 */;
import ApplicationStore from "ApplicationStore" /* 4984 */;
import ChannelSettingsStore from "ChannelSettingsStore" /* 8909 */;
import ChannelStore from "ChannelStore" /* 2042 */;
2026-07-20 16:05:17 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function init() {
_null2 = ChannelSettingsStore.getChannel();
const category = ChannelSettingsStore.getCategory();
2026-07-23 10:11:24 +00:00
if (null == _null2) {
2026-07-20 16:05:17 +00:00
return false;
} else {
2026-07-23 10:11:24 +00:00
const guildId = _null2.getGuildId();
2026-07-29 08:29:29 +00:00
const guildId1 = _null2.getGuildId();
const obj4 = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(_null2.permissionOverwrites);
if (tmp) {
obj4[guildId1] = PermissionUtilsAll.makeEveryoneOverwrite(guildId1);
}
c16 = obj4;
c17 = obj4;
if (null == obj4[c20]) {
c20 = guildId;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
closure_5 = null != category;
const obj2 = PermissionUtilsAll;
tmp = null != guildId1 && null == obj4[guildId1];
obj2.areChannelsLocked(_null2, category, AppChannelPermissionUtils.getAppChannelBotUserId(_null2));
2026-09-02 09:53:35 +00:00
c21 = null;
c15 = false;
2026-08-24 06:08:38 +00:00
CLOSED = FormStates.CLOSED;
2026-07-20 16:05:17 +00:00
set.clear();
}
}
2026-07-23 10:11:24 +00:00
function syncChannelUpdates(id) {
if (null != channel) {
if (channel.id === id) {
channel = ChannelStore.getChannel(id);
2026-07-20 16:05:17 +00:00
if (null == channel) {
return false;
} else {
const category = ChannelSettingsStore.getCategory();
2026-07-23 10:11:24 +00:00
const guildId = channel.getGuildId();
2026-07-20 16:05:17 +00:00
if (null == guildId) {
return false;
} else {
2026-07-29 08:29:29 +00:00
const guildId1 = channel.getGuildId();
const obj2 = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(channel.permissionOverwrites);
if (tmp) {
obj2[guildId1] = PermissionUtilsAll.makeEveryoneOverwrite(guildId1);
2026-07-29 08:29:29 +00:00
}
const obj4 = {};
const item = set.forEach((item) => {
if (null != obj7) {
obj4[item] = obj7[item];
2026-07-20 16:05:17 +00:00
}
});
let tmp6 = null == obj4[guildId];
2026-07-29 08:29:29 +00:00
if (tmp6) {
tmp6 = null == channel.permissionOverwrites[guildId];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp6) {
obj4[guildId] = PermissionUtilsAll.makeEveryoneOverwrite(guildId);
2026-07-20 16:05:17 +00:00
}
const obj7 = {};
2026-07-29 08:29:29 +00:00
const merged1 = Object.assign(channel.permissionOverwrites);
const merged2 = Object.assign(obj4);
if (null == obj7[closure_20]) {
2026-09-02 09:53:35 +00:00
closure_20 = guildId;
2026-07-20 16:05:17 +00:00
} else {
2026-09-02 09:53:35 +00:00
let tmp18 = null != c21;
2026-07-29 08:29:29 +00:00
if (tmp18) {
tmp18 = null != obj7[c21];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp18) {
2026-09-02 09:53:35 +00:00
closure_20 = c21;
c21 = null;
2026-07-20 16:05:17 +00:00
}
}
const obj5 = PermissionUtilsAll;
tmp = null != guildId1 && null == obj2[guildId1];
closure_4 = obj5.areChannelsLocked(channel, category, obj4(11865).getAppChannelBotUserId(channel));
2026-07-20 16:05:17 +00:00
return true;
}
}
}
}
return false;
}
const Constants = fn(1074);
({ ChannelSettingsSections: closure_9, ChannelTypes: c10, FormStates } = Constants);
const ADVANCED_MODE_ON_KEY = fn(8676).ADVANCED_MODE_ON_KEY;
const set = new Set();
2026-07-23 10:11:24 +00:00
let CLOSED = FormStates.CLOSED;
2026-09-02 09:53:35 +00:00
let c15 = false;
2026-07-29 08:29:29 +00:00
let c16 = null;
let c17 = null;
let c18 = null;
2026-07-23 10:11:24 +00:00
let c19 = null;
2026-09-02 09:53:35 +00:00
let c20 = null;
let c21 = null;
let Storage = fn(510).Storage;
let advancedMode = Storage.get(ADVANCED_MODE_ON_KEY) || false;
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class ChannelSettingsPermissionsStore extends Store {
}
const prototype = ChannelSettingsPermissionsStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(ChannelSettingsStore, ChannelStore, ApplicationStore);
2026-07-29 08:29:29 +00:00
};
prototype["hasChanges"] = function hasChanges() {
2026-09-02 09:53:35 +00:00
return c15;
2026-07-29 08:29:29 +00:00
};
prototype["showNotice"] = function showNotice() {
return this.hasChanges();
};
prototype["getPermissionOverwrite"] = function getPermissionOverwrite(arg0) {
let tmp2;
2026-09-02 09:53:35 +00:00
if (c16 != null) {
2026-07-29 08:29:29 +00:00
tmp2 = tmp[arg0];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
};
Object.defineProperty(prototype, "editedPermissionIds", {
get: function editedPermissionIds() {
return Array.from(set);
},
set: undefined
});
Object.defineProperty(prototype, "permissionOverwrites", {
get: function permissionOverwrites() {
2026-09-02 09:53:35 +00:00
return c16;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "selectedOverwriteId", {
get: function selectedOverwriteId() {
2026-09-02 09:53:35 +00:00
return c20;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "formState", {
get: function formState() {
return CLOSED;
},
set: undefined
});
Object.defineProperty(prototype, "isLockable", {
get: function isLockable() {
return closure_5;
},
set: undefined
});
Object.defineProperty(prototype, "locked", {
get: function locked() {
return areChannelsLockedResult;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "channel", {
get: function channel() {
2026-09-02 09:53:35 +00:00
return c18;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "category", {
get: function category() {
2026-09-02 09:53:35 +00:00
return c19;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "advancedMode", {
get: function advancedMode() {
return advancedMode;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
ChannelSettingsPermissionsStore.displayName = "ChannelSettingsPermissionsStore";
const channelSettingsPermissionsStore = new ChannelSettingsPermissionsStore(DispatcherDefault, {
2026-07-20 16:05:17 +00:00
CHANNEL_SETTINGS_SET_SECTION: function handleSetSection(arg0) {
2026-09-02 09:53:35 +00:00
if (null == c18) {
2026-07-20 16:05:17 +00:00
if (tmp === constants.PERMISSIONS) {
init();
}
}
return false;
},
CHANNEL_SETTINGS_PERMISSIONS_INIT: init,
CHANNEL_SETTINGS_PERMISSIONS_UPDATE_PERMISSION: function handleUpdatePermission(id) {
id = id.id;
let tmp;
({ allow, deny } = id);
if (_null != null) {
tmp = _null[id];
2026-07-20 16:05:17 +00:00
}
if (null != tmp) {
2026-09-02 09:53:35 +00:00
if (null != c18) {
const obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(tmp);
2026-07-29 08:29:29 +00:00
obj.allow = allow;
obj.deny = deny;
const obj2 = {};
const merged1 = Object.assign(_null);
obj2[id] = obj;
_null = obj2;
2026-07-20 16:05:17 +00:00
set.add(id);
CLOSED = FormStates.OPEN;
c15 = !_modDef12.isEqual(_null, c17);
const obj4 = PermissionUtilsAll;
obj4.areChannelsLocked(c18, c19, AppChannelPermissionUtils.getAppChannelBotUserId(c18));
2026-07-20 16:05:17 +00:00
}
}
return false;
},
CHANNEL_SETTINGS_PERMISSIONS_SELECT_PERMISSION: function handleSelectPermission(id) {
id = id.id;
if (null != _null) {
if (null != _null[id]) {
c20 = id;
}
}
2026-09-02 09:53:35 +00:00
if (null == c18) {
2026-07-20 16:05:17 +00:00
return false;
} else {
c21 = id;
2026-07-20 16:05:17 +00:00
}
},
CHANNEL_SETTINGS_INIT: function handleInit() {
if (ChannelSettingsStore.getSection() === constants.PERMISSIONS) {
2026-07-20 16:05:17 +00:00
init();
}
},
CHANNEL_SETTINGS_CLOSE: function handleClose() {
2026-08-24 06:08:38 +00:00
CLOSED = FormStates.CLOSED;
c16 = null;
c17 = null;
c18 = null;
c19 = null;
2026-09-02 09:53:35 +00:00
c15 = false;
set.clear();
c20 = null;
c21 = null;
2026-07-20 16:05:17 +00:00
},
2026-07-29 08:29:29 +00:00
CHANNEL_UPDATES: function handleChannelUpdates(channels) {
channels = channels.channels;
2026-09-02 09:53:35 +00:00
if (null == c18) {
2026-07-20 16:05:17 +00:00
return false;
} else {
let flag2 = false;
2026-07-29 08:29:29 +00:00
const tmp2 = channels[Symbol.iterator]();
while (tmp2 !== undefined) {
if (false !== syncChannelUpdates(tmp4.id)) {
flag2 = true;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag2;
2026-07-20 16:05:17 +00:00
}
},
CHANNEL_SETTINGS_PERMISSIONS_SUBMITTING: function handleSubmitting() {
CLOSED = FormStates.SUBMITTING;
2026-07-20 16:05:17 +00:00
},
CHANNEL_SETTINGS_PERMISSIONS_SAVE_SUCCESS: function handleSaveSuccess(silent) {
if (silent.silent) {
2026-08-24 06:08:38 +00:00
CLOSED = tmp.OPEN;
2026-07-20 16:05:17 +00:00
} else {
CLOSED = tmp.CLOSED;
init();
}
},
CHANNEL_SETTINGS_PERMISSIONS_SET_ADVANCED_MODE: function handleSetAdvancedMode(advancedMode) {
advancedMode = advancedMode.advancedMode;
2026-08-24 06:08:38 +00:00
const Storage = Storage2.Storage;
2026-07-20 16:05:17 +00:00
const result = Storage.set(ADVANCED_MODE_ON_KEY, advancedMode);
2026-09-02 09:53:35 +00:00
},
APPLICATION_FETCH_SUCCESS: function handleApplicationFetchSuccess() {
if (null != _null2) {
if (_null2.type === constants2.GUILD_APP) {
const obj = PermissionUtilsAll;
areChannelsLockedResult = obj.areChannelsLocked(_null2, c19, AppChannelPermissionUtils.getAppChannelBotUserId(_null2));
return areChannelsLockedResult !== areChannelsLockedResult;
2026-09-02 09:53:35 +00:00
}
}
return false;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
});
const size = fn(2);
let result = size.fileFinishedImporting("stores/ChannelSettingsPermissionsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default channelSettingsPermissionsStore;