decord/source/stores/ChannelSettingsPermissionsStore.tsx
github-actions cd74c1f217 chore: update source for alpha 345.5
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9667_m.js (378 MB)
2026-09-05 10:56:28 +00:00

295 lines
8.7 KiB
TypeScript

// Module ID: 16822
// Function ID: 16823
// Name: init
// Dependencies: [4788, 8626, 1957, 1074, 8401, 510, 4204, 11610, 12, 504, 573, 2]
// Module 16822 (init)
import applyDefault from "apply" /* 12 */;
import initializeDefault from "initialize" /* 504 */;
import Storage2 from "Storage" /* 510 */;
import dispatcherDefault from "dispatcher" /* 573 */;
import applyOverwritesAll from "applyOverwrites" /* 4204 */;
import getAppChannelBotUserIdFromApplication from "getAppChannelBotUserIdFromApplication" /* 11610 */;
import closure_6 from "addApplication" /* 4788 */;
import closure_7 from "normalizeChannelPropertyForCompare" /* 8626 */;
import closure_8 from "ensureGuildLoaded" /* 1957 */;
import ME from "ME" /* 1074 */;
import { ADVANCED_MODE_ON_KEY } from "RowType" /* 8401 */;
import { Storage } from "Storage" /* 510 */;
import set from "set" /* 2 */;
require = arg1;
function init() {
const _null2 = store.getChannel();
const category = store.getCategory();
if (null == _null2) {
return false;
} else {
const guildId = _null2.getGuildId();
const guildId1 = _null2.getGuildId();
let obj = {};
const merged = Object.assign(_null2.permissionOverwrites);
if (tmp) {
obj = applyOverwritesAll;
obj[guildId1] = obj.makeEveryoneOverwrite(guildId1);
}
closure_5 = null != category;
const obj2 = applyOverwritesAll;
tmp = null != guildId1 && null == obj[guildId1];
closure_4 = obj2.areChannelsLocked(_null2, category, getAppChannelBotUserIdFromApplication.getAppChannelBotUserId(_null2));
c21 = null;
c15 = false;
CLOSED = FormStates.CLOSED;
set.clear();
}
}
function syncChannelUpdates(id) {
if (null != channel) {
if (channel.id === id) {
channel = channel.getChannel(id);
if (null == channel) {
return false;
} else {
const category = store.getCategory();
const guildId = channel.getGuildId();
if (null == guildId) {
return false;
} else {
const guildId1 = channel.getGuildId();
let obj = {};
const merged = Object.assign(channel.permissionOverwrites);
if (tmp) {
obj = applyOverwritesAll;
obj[guildId1] = obj.makeEveryoneOverwrite(guildId1);
}
obj = {};
const item = set.forEach((arg0) => {
if (null != obj1) {
obj[arg0] = obj1[arg0];
}
});
let tmp6 = null == obj[guildId];
if (tmp6) {
tmp6 = null == channel.permissionOverwrites[guildId];
}
if (tmp6) {
obj[guildId] = applyOverwritesAll.makeEveryoneOverwrite(guildId);
const obj3 = applyOverwritesAll;
}
obj1 = {};
const merged1 = Object.assign(channel.permissionOverwrites);
const merged2 = Object.assign(obj);
if (null == obj1[closure_20]) {
closure_20 = guildId;
} else {
let tmp18 = null != c21;
if (tmp18) {
tmp18 = null != obj1[c21];
}
if (tmp18) {
closure_20 = c21;
c21 = null;
}
}
const obj5 = applyOverwritesAll;
tmp = null != guildId1 && null == obj[guildId1];
closure_4 = obj5.areChannelsLocked(channel, category, obj(11610).getAppChannelBotUserId(channel));
return true;
}
}
}
}
return false;
}
({ ChannelSettingsSections: c9, ChannelTypes: c10, FormStates } = ME);
let set = new Set();
let CLOSED = FormStates.CLOSED;
let c15 = false;
let c16 = null;
let c17 = null;
let c18 = null;
let c19 = null;
let c20 = null;
let c21 = null;
let closure_22 = Storage.get(ADVANCED_MODE_ON_KEY) || false;
const Store = initializeDefault.Store;
class ChannelSettingsPermissionsStore extends Store {
}
const prototype = ChannelSettingsPermissionsStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(closure_7, closure_8, closure_6);
};
prototype["hasChanges"] = function hasChanges() {
return c15;
};
prototype["showNotice"] = function showNotice() {
return this.hasChanges();
};
prototype["getPermissionOverwrite"] = function getPermissionOverwrite(arg0) {
let tmp2;
if (c16 != null) {
tmp2 = tmp[arg0];
}
return tmp2;
};
Object.defineProperty(prototype, "editedPermissionIds", {
get: function editedPermissionIds() {
return Array.from(set);
},
set: undefined
});
Object.defineProperty(prototype, "permissionOverwrites", {
get: function permissionOverwrites() {
return c16;
},
set: undefined
});
Object.defineProperty(prototype, "selectedOverwriteId", {
get: function selectedOverwriteId() {
return c20;
},
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 closure_4;
},
set: undefined
});
Object.defineProperty(prototype, "channel", {
get: function channel(channel, arg1) {
return c18;
},
set: undefined
});
Object.defineProperty(prototype, "category", {
get: function category(arg0) {
return c19;
},
set: undefined
});
Object.defineProperty(prototype, "advancedMode", {
get: function advancedMode() {
return closure_22;
},
set: undefined
});
ChannelSettingsPermissionsStore.displayName = "ChannelSettingsPermissionsStore";
const channelSettingsPermissionsStore = new ChannelSettingsPermissionsStore(dispatcherDefault, {
CHANNEL_SETTINGS_SET_SECTION: function handleSetSection(arg0) {
if (null == c18) {
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 (obj != null) {
tmp = obj[id];
}
if (null != tmp) {
if (null != c18) {
obj = {};
const merged = Object.assign(tmp);
obj.allow = allow;
obj.deny = deny;
obj = {};
const merged1 = Object.assign(obj);
obj[id] = obj;
set.add(id);
const OPEN = FormStates.OPEN;
closure_15 = !applyDefault.isEqual(obj, c17);
const obj3 = applyDefault;
const obj4 = applyOverwritesAll;
closure_4 = obj4.areChannelsLocked(c18, c19, getAppChannelBotUserIdFromApplication.getAppChannelBotUserId(c18));
}
}
return false;
},
CHANNEL_SETTINGS_PERMISSIONS_SELECT_PERMISSION: function handleSelectPermission(id) {
id = id.id;
if (null == c18) {
return false;
}
},
CHANNEL_SETTINGS_INIT: function handleInit() {
if (store.getSection() === constants.PERMISSIONS) {
init();
}
},
CHANNEL_SETTINGS_CLOSE: function handleClose() {
CLOSED = FormStates.CLOSED;
c16 = null;
c17 = null;
c18 = null;
c19 = null;
c15 = false;
set.clear();
c20 = null;
c21 = null;
},
CHANNEL_UPDATES: function handleChannelUpdates(channels) {
channels = channels.channels;
if (null == c18) {
return false;
} else {
let flag2 = false;
const tmp2 = channels[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp6 = syncChannelUpdates;
if (false !== syncChannelUpdates(tmp4.id)) {
flag2 = true;
}
continue;
}
return flag2;
}
},
CHANNEL_SETTINGS_PERMISSIONS_SUBMITTING: function handleSubmitting() {
const SUBMITTING = FormStates.SUBMITTING;
},
CHANNEL_SETTINGS_PERMISSIONS_SAVE_SUCCESS: function handleSaveSuccess(silent) {
if (silent.silent) {
CLOSED = tmp.OPEN;
} else {
CLOSED = tmp.CLOSED;
init();
}
},
CHANNEL_SETTINGS_PERMISSIONS_SET_ADVANCED_MODE: function handleSetAdvancedMode(advancedMode) {
advancedMode = advancedMode.advancedMode;
const Storage = Storage2.Storage;
const result = Storage.set(ADVANCED_MODE_ON_KEY, advancedMode);
},
APPLICATION_FETCH_SUCCESS: function handleApplicationFetchSuccess() {
if (null != _null2) {
if (_null2.type === constants2.GUILD_APP) {
const obj = applyOverwritesAll;
const areChannelsLockedResult = obj.areChannelsLocked(_null2, c19, getAppChannelBotUserIdFromApplication.getAppChannelBotUserId(_null2));
closure_4 = areChannelsLockedResult;
return areChannelsLockedResult !== closure_4;
}
}
return false;
}
});
let result = set.fileFinishedImporting("stores/ChannelSettingsPermissionsStore.tsx");
export default channelSettingsPermissionsStore;