decord/source/stores/ChannelSettingsPermissionsStore.tsx

277 lines
7.6 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 15749
// Function ID: 15750
2026-07-29 08:29:29 +00:00
// Name: init
2026-08-05 07:35:12 +00:00
// Dependencies: [7799, 1372, 676, 7676, 595, 3888, 12, 589, 709, 2]
2026-07-23 10:11:24 +00:00
2026-08-05 07:35:12 +00:00
// Module 15749 (init)
2026-07-29 08:29:29 +00:00
import normalizeChannelPropertyForCompare from "normalizeChannelPropertyForCompare";
import ensureGuildLoaded from "ensureGuildLoaded";
2026-07-23 10:11:24 +00:00
import ME from "ME";
import { ADVANCED_MODE_ON_KEY } from "RowType";
import { Storage } from "Storage";
2026-07-29 08:29:29 +00:00
import { Store } from "initialize";
import set from "ME";
2026-07-20 16:05:17 +00:00
let FormStates;
2026-07-29 08:29:29 +00:00
let metroImportAll;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function init() {
2026-07-23 10:11:24 +00:00
const _null2 = store.getChannel();
2026-07-20 16:05:17 +00:00
const category = store.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();
let obj = {};
const merged = Object.assign(_null2.permissionOverwrites);
if (tmp) {
2026-08-05 07:35:12 +00:00
obj = importAll(3888);
2026-07-29 08:29:29 +00:00
obj[guildId1] = obj.makeEveryoneOverwrite(guildId1);
}
let closure_5 = null != category;
2026-08-05 07:35:12 +00:00
let closure_4 = importAll(3888).areChannelsLocked(_null2, category);
2026-07-29 08:29:29 +00:00
let c19 = null;
let c13 = false;
2026-07-20 16:05:17 +00:00
const CLOSED = FormStates.CLOSED;
set.clear();
}
}
2026-07-23 10:11:24 +00:00
function syncChannelUpdates(id) {
if (null != channel) {
if (channel.id === id) {
channel = channel.getChannel(id);
2026-07-20 16:05:17 +00:00
if (null == channel) {
return false;
} else {
const category = store.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();
2026-07-20 16:05:17 +00:00
let obj = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(channel.permissionOverwrites);
if (tmp) {
2026-08-05 07:35:12 +00:00
obj = importAll(3888);
2026-07-29 08:29:29 +00:00
obj[guildId1] = obj.makeEveryoneOverwrite(guildId1);
}
obj = {};
2026-07-20 16:05:17 +00:00
const item = set.forEach((arg0) => {
2026-07-29 08:29:29 +00:00
if (null != obj1) {
obj[arg0] = obj1[arg0];
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
let tmp6 = null == obj[guildId];
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) {
2026-08-05 07:35:12 +00:00
obj[guildId] = importAll(3888).makeEveryoneOverwrite(guildId);
const obj3 = importAll(3888);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj1 = {};
const merged1 = Object.assign(channel.permissionOverwrites);
const merged2 = Object.assign(obj);
if (null == obj1[closure_18]) {
closure_18 = guildId;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
let tmp18 = null != c19;
if (tmp18) {
tmp18 = null != obj1[c19];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp18) {
closure_18 = c19;
c19 = null;
2026-07-20 16:05:17 +00:00
}
}
2026-08-05 07:35:12 +00:00
let closure_4 = importAll(3888).areChannelsLocked(channel, category);
2026-07-20 16:05:17 +00:00
return true;
}
}
}
}
return false;
}
2026-07-29 08:29:29 +00:00
({ ChannelSettingsSections: metroImportAll, FormStates } = ME);
2026-07-23 10:11:24 +00:00
let set = new Set();
let CLOSED = FormStates.CLOSED;
2026-07-29 08:29:29 +00:00
let c13 = false;
let c14 = null;
let c15 = null;
let c16 = null;
let c17 = null;
let c18 = null;
2026-07-23 10:11:24 +00:00
let c19 = null;
2026-07-29 08:29:29 +00:00
let closure_20 = Storage.get(ADVANCED_MODE_ON_KEY) || false;
class ChannelSettingsPermissionsStore extends Store {
}
const prototype = ChannelSettingsPermissionsStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(normalizeChannelPropertyForCompare, ensureGuildLoaded);
};
prototype["hasChanges"] = function hasChanges() {
return c13;
};
prototype["showNotice"] = function showNotice() {
return this.hasChanges();
};
prototype["getPermissionOverwrite"] = function getPermissionOverwrite(arg0) {
let tmp2;
if (c14 != null) {
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() {
return c14;
},
set: undefined
});
Object.defineProperty(prototype, "selectedOverwriteId", {
get: function selectedOverwriteId() {
return c18;
},
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 c16;
},
set: undefined
});
Object.defineProperty(prototype, "category", {
get: function category(arg0) {
return c17;
},
set: undefined
});
Object.defineProperty(prototype, "advancedMode", {
get: function advancedMode() {
return closure_20;
},
set: undefined
});
ChannelSettingsPermissionsStore.displayName = "ChannelSettingsPermissionsStore";
const channelSettingsPermissionsStore = new ChannelSettingsPermissionsStore(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
CHANNEL_SETTINGS_SET_SECTION: function handleSetSection(arg0) {
2026-07-29 08:29:29 +00:00
if (null == c16) {
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) {
let allow;
let deny;
id = id.id;
let tmp;
({ allow, deny } = id);
2026-07-29 08:29:29 +00:00
if (obj != null) {
2026-07-23 10:11:24 +00:00
tmp = obj[id];
2026-07-20 16:05:17 +00:00
}
if (null != tmp) {
2026-07-29 08:29:29 +00:00
if (null != c16) {
2026-07-20 16:05:17 +00:00
obj = {};
const merged = Object.assign(tmp);
2026-07-29 08:29:29 +00:00
obj.allow = allow;
obj.deny = deny;
2026-07-20 16:05:17 +00:00
obj = {};
2026-07-23 10:11:24 +00:00
const merged1 = Object.assign(obj);
2026-07-20 16:05:17 +00:00
obj[id] = obj;
set.add(id);
2026-07-23 10:11:24 +00:00
const OPEN = FormStates.OPEN;
2026-07-29 08:29:29 +00:00
let closure_13 = !importDefault(12).isEqual(obj, c15);
const obj3 = importDefault(12);
2026-08-05 07:35:12 +00:00
let closure_4 = importAll(3888).areChannelsLocked(c16, c17);
2026-07-20 16:05:17 +00:00
}
}
return false;
},
CHANNEL_SETTINGS_PERMISSIONS_SELECT_PERMISSION: function handleSelectPermission(id) {
id = id.id;
2026-07-29 08:29:29 +00:00
if (null == c16) {
2026-07-20 16:05:17 +00:00
return false;
}
},
CHANNEL_SETTINGS_INIT: function handleInit() {
if (store.getSection() === constants.PERMISSIONS) {
init();
}
},
CHANNEL_SETTINGS_CLOSE: function handleClose() {
const CLOSED = FormStates.CLOSED;
2026-07-29 08:29:29 +00:00
let c14 = null;
let c15 = null;
let c16 = null;
let c17 = null;
let c13 = false;
2026-07-20 16:05:17 +00:00
set.clear();
2026-07-29 08:29:29 +00:00
let c18 = null;
let c19 = 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;
if (null == c16) {
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) {
let tmp6 = syncChannelUpdates;
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() {
2026-07-23 10:11:24 +00:00
const SUBMITTING = FormStates.SUBMITTING;
2026-07-20 16:05:17 +00:00
},
CHANNEL_SETTINGS_PERMISSIONS_SAVE_SUCCESS: function handleSaveSuccess(silent) {
if (silent.silent) {
let CLOSED = tmp.OPEN;
} else {
CLOSED = tmp.CLOSED;
init();
}
},
CHANNEL_SETTINGS_PERMISSIONS_SET_ADVANCED_MODE: function handleSetAdvancedMode(advancedMode) {
advancedMode = advancedMode.advancedMode;
2026-07-29 08:29:29 +00:00
const Storage = require(595) /* Storage */.Storage;
2026-07-20 16:05:17 +00:00
const result = Storage.set(ADVANCED_MODE_ON_KEY, advancedMode);
}
2026-07-23 10:11:24 +00:00
});
let result = set.fileFinishedImporting("stores/ChannelSettingsPermissionsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default channelSettingsPermissionsStore;