798 lines
35 KiB
TypeScript
798 lines
35 KiB
TypeScript
/* Metro module 3784; source: stores/PermissionStore.tsx; dependencies: [6, 7, 15, 17, 18, 1937, 3785, 1384, 3786, 1383, 1422, 1885, 1379, 1945, 1867, 1878, 661, 3788, 3789, 22, 3791, 1418, 483, 3792, 566, 694, 2] */
|
|
function _fun28667(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#28667, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6, offset: 0x00f7faec, size: 866 bytes, params: 8, frame: 28
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_28673 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const closure = function() {
|
|
rebuildPermissions();
|
|
};
|
|
const closure2 = function() {
|
|
rebuildPermissions();
|
|
};
|
|
const closure3 = function(a0) {
|
|
var id = a0.user.id;
|
|
var value2 = UserStore.getCurrentUser();
|
|
var value3 = undefined;
|
|
if (id !== (value2 == null ? value3 : value2.id)) {
|
|
return false;
|
|
}
|
|
rebuildPermissions();
|
|
return value3;
|
|
};
|
|
const closure4 = function() {
|
|
return true;
|
|
};
|
|
const closure5 = function({data}) {
|
|
return data.some(_fun28684);
|
|
};
|
|
const closure6 = GUILD_ROLE_CREATE_28687;
|
|
const closure7 = STAGE_INSTANCE_CREATE_28689;
|
|
const closure8 = IMPERSONATE_UPDATE_28690;
|
|
const closure9 = function() {
|
|
env0_25 = {};
|
|
env0_24 = {};
|
|
env0_26 = {};
|
|
env0_27 = 0;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_5 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_6 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_7 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_8 = importDefault(18) /* metro dependency 18 */;
|
|
const impersonateStore = importDefault(1937) /* metro dependency 1937: ImpersonateStore */;
|
|
const lurkingStore = importDefault(3785) /* metro dependency 3785: LurkingStore */;
|
|
const stageInstanceStore = importDefault(1384) /* metro dependency 1384: StageInstanceStore */;
|
|
const joinedThreadsStore = importDefault(3786) /* metro dependency 3786: JoinedThreadsStore */;
|
|
let value = require(1383) /* metro dependency 1383: ChannelRecord */;
|
|
const env0_13 = value.ChannelRecordBase;
|
|
const env0_14 = value.THREAD_CHANNEL_TYPES;
|
|
value = require(1422) /* metro dependency 1422: GuildRecord */;
|
|
const env0_15 = value.isGuildOwner;
|
|
const env0_16 = value.isGuildOwnerWithRequiredMfaLevel;
|
|
const userRecord = importDefault(1885) /* metro dependency 1885: UserRecord */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const env0_22 = (require(661) /* metro dependency 661: Constants */).Permissions;
|
|
const env0_23 = (require(3788) /* metro dependency 3788: MemberSafetyConstants */).MemberSafetyPagePermissions;
|
|
let env0_24 = {};
|
|
let env0_25 = {};
|
|
let env0_26 = {};
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
_fun28694(Store).displayName = 'PermissionStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {BACKGROUND_SYNC: closure,
|
|
CONNECTION_OPEN: closure, OVERLAY_INITIALIZE: closure, CACHE_LOADED: closure, CACHE_LOADED_LAZY: closure,
|
|
CONNECTION_CLOSED: function() {
|
|
LOGOUT_28693();
|
|
}, GUILD_CREATE: closure2, GUILD_UPDATE: closure2, GUILD_DELETE: closure2, GUILD_MEMBER_ADD: closure3,
|
|
GUILD_MEMBER_UPDATE: closure3, CURRENT_USER_UPDATE: closure3, CHANNEL_CREATE: CHANNEL_CREATE_28714,
|
|
THREAD_CREATE: closure4, THREAD_UPDATE: closure4, THREAD_LIST_SYNC: closure4, LOAD_THREADS_SUCCESS: closure4,
|
|
LOAD_ARCHIVED_THREADS_SUCCESS: closure4, CHANNEL_UPDATES: CHANNEL_UPDATES_28715,
|
|
LOAD_MESSAGES_SUCCESS: function({messages}) {
|
|
return messages.some(_fun28717);
|
|
}, SEARCH_MESSAGES_SUCCESS: closure5, MOD_VIEW_SEARCH_MESSAGES_SUCCESS: closure5,
|
|
THREAD_MEMBER_UPDATE: THREAD_MEMBER_UPDATE, THREAD_MEMBERS_UPDATE: THREAD_MEMBERS_UPDATE_28719,
|
|
CHANNEL_DELETE: CHANNEL_DELETE_28720, GUILD_ROLE_CREATE: closure6, GUILD_ROLE_UPDATE: closure6,
|
|
GUILD_ROLE_DELETE: closure6, LOGOUT: closure9, STAGE_INSTANCE_CREATE: closure7, STAGE_INSTANCE_UPDATE: closure7,
|
|
STAGE_INSTANCE_DELETE: closure7, IMPERSONATE_UPDATE: closure8, IMPERSONATE_STOP: closure8});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/PermissionStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_28668() { // fn#28668, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:433, offset: 0x00f7fe4e, size: 94 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_28668_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_28671(a0, a1) { // fn#28671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:626, offset: 0x00f7feac, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun28672;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_28673(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_28673(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_28673(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun28672;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
}
|
|
|
|
function _getGuildPermissions(a0) { // fn#28674, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:1559, offset: 0x00f8001e, size: 183 bytes, params: 2, frame: 19
|
|
var r2;
|
|
var binding;
|
|
undefined !== undefined;
|
|
var value;
|
|
const property = env0_24[a0];
|
|
if (property != null) {
|
|
return property;
|
|
}
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser == null) {
|
|
return (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
|
|
}
|
|
const guild = GuildStore.getGuild(a0);
|
|
if (guild == null) {
|
|
r2 = (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
|
|
} else {
|
|
binding = env0_24;
|
|
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
value = value.computePermissions({user: currentUser, context: guild, checkElevated: true});
|
|
binding[a0] = value;
|
|
r2 = value;
|
|
}
|
|
return r2;
|
|
}
|
|
|
|
function getUncachedChannelPermissions(a0) { // fn#28675, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:1806, offset: 0x00f800d5, size: 312 bytes, params: 2, frame: 21
|
|
var r1;
|
|
var defaultImport;
|
|
let value = a1;
|
|
const value2 = undefined;
|
|
const r6 = !(value !== value2) || value;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser == null) {
|
|
return (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
|
|
}
|
|
const channel = ChannelStore.getChannel(a0);
|
|
if (channel == null) {
|
|
return (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
|
|
}
|
|
const guildId = channel.getGuildId();
|
|
if (channel.isScheduledForDeletion()) {
|
|
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
value = value.computePermissions({user: currentUser, context: channel, checkElevated: r6});
|
|
r1 = value;
|
|
} else if (guildId != null && (LurkingStore.isLurking(guildId) || (GuildMemberStore.getMember(guildId,
|
|
currentUser.id) == null ? value2 : GuildMemberStore.getMember(guildId, currentUser.id).isPending))) {
|
|
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
value = value.computePermissions({user: currentUser, context: channel, checkElevated: r6});
|
|
r1 = value;
|
|
} else {
|
|
defaultImport = importDefault(22) /* metro dependency 22 */;
|
|
if (defaultImport.isEmpty(channel.permissionOverwrites)) {
|
|
if (guildId == null) {
|
|
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
value = value.computePermissions({user: currentUser, context: channel, checkElevated: r6});
|
|
r1 = value;
|
|
} else {
|
|
r1 = _getGuildPermissions(guildId);
|
|
}
|
|
} else {
|
|
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
value = value.computePermissions({user: currentUser, context: channel, checkElevated: r6});
|
|
r1 = value;
|
|
}
|
|
}
|
|
return r1;
|
|
}
|
|
|
|
function _getChannelPermissions(a0) { // fn#28676, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2247, offset: 0x00f8020d, size: 53 bytes, params: 2, frame: 15
|
|
var r0;
|
|
var binding;
|
|
undefined !== undefined;
|
|
var uncachedChannelPermissions;
|
|
const property = env0_25[a0];
|
|
if (property != null) {
|
|
r0 = property;
|
|
} else {
|
|
binding = env0_25;
|
|
uncachedChannelPermissions = getUncachedChannelPermissions(a0, true);
|
|
binding[a0] = uncachedChannelPermissions;
|
|
r0 = uncachedChannelPermissions;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function updateGuildVersion(a0) { // fn#28677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2355, offset: 0x00f80242, size: 47 bytes, params: 2, frame: 5
|
|
var binding;
|
|
if (a0 != null) {
|
|
binding = env0_26;
|
|
binding[a0] = (binding[a0] ?? 0) + 1;
|
|
}
|
|
}
|
|
|
|
function rebuildPermissions() { // fn#28678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2431, offset: 0x00f80271, size: 76 bytes, params: 1, frame: 10
|
|
var propertyName;
|
|
var binding2;
|
|
env0_24 = {};
|
|
env0_25 = {};
|
|
for (propertyName in env0_26) {
|
|
binding2 = env0_26;
|
|
binding2[propertyName] += 1;
|
|
}
|
|
env0_27 += 1;
|
|
}
|
|
|
|
function MOD_VIEW_SEARCH_MESSAGES_SUCCESS_28683({data}) { // fn#28683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2767, offset: 0x00f8030d, size: 28 bytes, params: 2, frame: 11
|
|
return data.some(function(a0) {
|
|
return a0.threads.length > 0 || a0.messages.some(_fun28685);
|
|
});
|
|
}
|
|
|
|
function GUILD_ROLE_CREATE_28687({guildId}) { // fn#28687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2910, offset: 0x00f80382, size: 100 bytes, params: 2, frame: 16
|
|
delete env0_24[guildId];
|
|
(importDefault(22) /* metro dependency 22 */).forEach(ChannelStore.getMutableBasicGuildChannelsForGuild(guildId),
|
|
_fun28688);
|
|
env0_27 += 1;
|
|
updateGuildVersion(guildId);
|
|
}
|
|
|
|
function STAGE_INSTANCE_CREATE_28689({instance}) { // fn#28689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3077, offset: 0x00f803fd, size: 148 bytes, params: 2, frame: 15
|
|
const channel = ChannelStore.getChannel(instance.channel_id);
|
|
if (channel == null) {
|
|
return false;
|
|
}
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const permissionUtilsModule = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
const permissions = permissionUtilsModule.computePermissions({user: currentUser, context: channel});
|
|
if (permissions === env0_25[channel.id]) {
|
|
return false;
|
|
}
|
|
env0_25[channel.id] = permissions;
|
|
env0_27 += 1;
|
|
}
|
|
|
|
function IMPERSONATE_STOP_28690({guildId}) { // fn#28690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3296, offset: 0x00f80491, size: 100 bytes, params: 2, frame: 16
|
|
delete env0_24[guildId];
|
|
(importDefault(22) /* metro dependency 22 */).forEach(ChannelStore.getMutableBasicGuildChannelsForGuild(guildId),
|
|
_fun28691);
|
|
env0_27 += 1;
|
|
updateGuildVersion(guildId);
|
|
}
|
|
|
|
function _computePermissions(a0, a1, a2, a3) { // fn#28692, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3471, offset: 0x00f804f5, size: 375 bytes, params: 5, frame: 24
|
|
var r0;
|
|
var moduleValue2;
|
|
var computePermissions;
|
|
var object2;
|
|
var value4;
|
|
var moduleValue3;
|
|
const NONE = (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
|
|
if (a0 instanceof ChannelRecordBase) {
|
|
if (THREAD_CHANNEL_TYPES.has(a0.type)) {
|
|
value4 = ChannelStore.getChannel(a0.parent_id);
|
|
if (value4 == null) {
|
|
r0 = (importAll(3789) /* metro dependency 3789: PermissionUtils */).NONE;
|
|
} else {
|
|
moduleValue3 = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
r0 = moduleValue3.applyThreadPermissions(a0, _computePermissions(value4, a1, a2, a3),
|
|
JoinedThreadsStore.hasJoined(a0.id), GuildMemberStore.isCurrentUserGuest(a0.guild_id));
|
|
}
|
|
return r0;
|
|
}
|
|
r0 = _getChannelPermissions(a0.id);
|
|
} else {
|
|
var moduleValue = require(1418) /* metro dependency 1418: GuildRecordUtils */;
|
|
if (moduleValue.isGuildRecord(a0)) {
|
|
r0 = _getGuildPermissions(a0.id);
|
|
} else {
|
|
r0 = NONE;
|
|
}
|
|
}
|
|
if (a1 !== undefined) {
|
|
moduleValue2 = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
computePermissions = moduleValue2.computePermissions;
|
|
object2 = {};
|
|
object2.user = UserStore.getCurrentUser();
|
|
object2.context = a0;
|
|
object2.overwrites = a1;
|
|
object2.roles = a2;
|
|
object2.checkElevated = true;
|
|
object2.excludeGuildPermissions = a3;
|
|
r0 = Reflect.apply(computePermissions, moduleValue2, [object2]);
|
|
} else if (a2 !== undefined) {
|
|
moduleValue2 = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
computePermissions = moduleValue2.computePermissions;
|
|
object2 = {};
|
|
object2.user = UserStore.getCurrentUser();
|
|
object2.context = a0;
|
|
object2.overwrites = a1;
|
|
object2.roles = a2;
|
|
object2.checkElevated = true;
|
|
object2.excludeGuildPermissions = a3;
|
|
r0 = Reflect.apply(computePermissions, moduleValue2, [object2]);
|
|
} else if (a3 !== undefined) {
|
|
moduleValue2 = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
computePermissions = moduleValue2.computePermissions;
|
|
object2 = {};
|
|
object2.user = UserStore.getCurrentUser();
|
|
object2.context = a0;
|
|
object2.overwrites = a1;
|
|
object2.roles = a2;
|
|
object2.checkElevated = true;
|
|
object2.excludeGuildPermissions = a3;
|
|
r0 = Reflect.apply(computePermissions, moduleValue2, [object2]);
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun28694(a0) { // fn#28694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:4020, offset: 0x00f8068b, size: 444 bytes, params: 2, frame: 16
|
|
const closure = PermissionStore;
|
|
env0_8(closure, a0);
|
|
return env0_5(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(ChannelStore, GuildMemberStore, GuildStore, ImpersonateStore, JoinedThreadsStore, LurkingStore,
|
|
StageInstanceStore, UserStore);
|
|
}}, {key: 'getChannelPermissions', value: value_28697}, {key: 'getGuildPermissions', value: function(a0) {
|
|
return _getGuildPermissions(a0.id);
|
|
}}, {key: 'getGuildPermissionProps', value: value_28699}, {key: 'canAccessMemberSafetyPage', value: function(a0) {
|
|
return importAll(dependencyMap[22]).hasAny(_getGuildPermissions(a0.id), MemberSafetyPagePermissions);
|
|
}}, {key: 'canAccessGuildSettings', value: value_28701}, {key: 'canWithPartialContext', value: value_28702},
|
|
{key: 'can', value: value_28703}, {key: 'canBasicChannel', value: value_28704}, {key: 'computePermissions',
|
|
value: function(a0, a1, a2, a3) {
|
|
return _computePermissions(a0, a1, a2, a3);
|
|
}}, {key: 'computeBasicPermissions', value: value_28706}, {key: 'canManageUser', value: value_28707},
|
|
{key: 'getHighestRole', value: value_28708}, {key: 'isRoleHigher', value: value_28709},
|
|
{key: 'canImpersonateRole', value: function(a0, a1) {
|
|
var value = this.getHighestRole(a0);
|
|
return this.can(Permissions.MANAGE_GUILD, a0) && this.can(Permissions.MANAGE_ROLES,
|
|
a0) && (this.isRoleHigher(a0,
|
|
value, a1) || a1.id === value?.id);
|
|
}}, {key: 'getGuildVersion', value: value_28711}, {key: 'getChannelsVersion', value: value_28712}]);
|
|
}
|
|
|
|
function CHANNEL_CREATE_28714({channel}) { // fn#28714, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:7808, offset: 0x00f80f39, size: 185 bytes, params: 2, frame: 15
|
|
const channel2 = ChannelStore.getChannel(channel.id);
|
|
if (channel2 == null) {
|
|
return false;
|
|
}
|
|
if (channel2.isPrivate()) {
|
|
return false;
|
|
}
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const permissionUtilsModule = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
const permissions = permissionUtilsModule.computePermissions({user: currentUser, context: channel2});
|
|
if (env0_25[channel2.id] === permissions) {
|
|
return false;
|
|
}
|
|
env0_25[channel2.id] = permissions;
|
|
env0_27 += 1;
|
|
const updateGuildVersionBinding = updateGuildVersion;
|
|
const getGuildId = channel2.getGuildId;
|
|
updateGuildVersionBinding(Reflect.apply(getGuildId, channel2, []));
|
|
}
|
|
|
|
function CHANNEL_UPDATES_28715({channels}) { // fn#28715, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:8270, offset: 0x00f80ff2, size: 275 bytes, params: 2, frame: 25
|
|
var r4;
|
|
var r5;
|
|
var r11;
|
|
var r1;
|
|
var r0;
|
|
var value5;
|
|
var id;
|
|
var channel;
|
|
var isPrivate;
|
|
var currentUser;
|
|
var moduleValue;
|
|
var permissions;
|
|
var binding;
|
|
var updateGuildVersionBinding;
|
|
var getGuildId;
|
|
var value8;
|
|
var value9;
|
|
const value2 = _createForOfIteratorHelperLoose_28671(channels);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (done) {
|
|
r1 = false;
|
|
} else {
|
|
r4 = false;
|
|
r5 = value3;
|
|
while (true) {
|
|
value5 = r5.value;
|
|
id = value5.id;
|
|
channel = ChannelStore.getChannel(id);
|
|
if (channel != null) {
|
|
isPrivate = channel.isPrivate;
|
|
if (Reflect.apply(isPrivate, channel, [])) {
|
|
r11 = r4;
|
|
break;
|
|
}
|
|
currentUser = UserStore.getCurrentUser();
|
|
moduleValue = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
permissions = moduleValue.computePermissions({user: currentUser, context: channel});
|
|
binding = env0_25;
|
|
id = channel.id;
|
|
if (binding[id] === permissions) {
|
|
r11 = r4;
|
|
break;
|
|
}
|
|
binding = env0_25;
|
|
id = channel.id;
|
|
binding[id] = permissions;
|
|
updateGuildVersionBinding = updateGuildVersion;
|
|
getGuildId = channel.getGuildId;
|
|
updateGuildVersionBinding(Reflect.apply(getGuildId, channel, []));
|
|
value8 = true;
|
|
r11 = value8;
|
|
break;
|
|
}
|
|
r11 = r4;
|
|
value9 = value2();
|
|
done = value9.done;
|
|
if (done) {
|
|
r1 = r11;
|
|
break;
|
|
}
|
|
r4 = r11;
|
|
r5 = value9;
|
|
continue;
|
|
}
|
|
}
|
|
if (r1) {
|
|
env0_27 += 1;
|
|
r0 = r1;
|
|
} else {
|
|
r0 = !!r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function LOAD_MESSAGES_SUCCESS({messages}) { // fn#28716, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:8630, offset: 0x00f81105, size: 29 bytes, params: 2, frame: 11
|
|
return messages.some(function(a0) {
|
|
return a0.thread != null;
|
|
});
|
|
}
|
|
|
|
function THREAD_MEMBER_UPDATE(a0) { // fn#28718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:8849, offset: 0x00f81122, size: 67 bytes, params: 2, frame: 14
|
|
var r0;
|
|
const id = UserStore.getCurrentUser()?.id;
|
|
const userId = a0.userId;
|
|
const value4 = id === userId;
|
|
if (value4) {
|
|
updateGuildVersion(a0.guildId);
|
|
r0 = true;
|
|
} else {
|
|
r0 = value4;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function THREAD_MEMBERS_UPDATE_28719(a0) { // fn#28719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:9011, offset: 0x00f81165, size: 66 bytes, params: 2, frame: 13
|
|
var r0;
|
|
const value2 = (require(3791) /* metro dependency 3791: ThreadActionUtils */).doesThreadMembersActionAffectMe(a0);
|
|
if (value2) {
|
|
updateGuildVersion(a0.guildId);
|
|
r0 = true;
|
|
} else {
|
|
r0 = !!value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function CHANNEL_DELETE_28720({channel}) { // fn#28720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:9154, offset: 0x00f811a7, size: 59 bytes, params: 2, frame: 12
|
|
delete env0_25[channel.id];
|
|
env0_27 += 1;
|
|
updateGuildVersion(channel.guild_id);
|
|
return false;
|
|
}
|
|
|
|
function _fun28684({messages, threads}) { // fn#28684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2829, offset: 0x00f80329, size: 49 bytes, params: 2, frame: 12
|
|
return threads.length > 0 || messages.some(function(a0) {
|
|
return a0.some(_fun28686);
|
|
});
|
|
}
|
|
|
|
function _fun28688({id}) { // fn#28688, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:3028, offset: 0x00f803e6, size: 23 bytes, params: 2, frame: 2
|
|
delete env1_25[id];
|
|
}
|
|
|
|
function value_28697(a0) { // fn#28697, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:4403, offset: 0x00f808ef, size: 64 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__;
|
|
return THREAD_CHANNEL_TYPES.has(a0.type) ? getUncachedChannelPermissions(a0.id) : _getChannelPermissions(a0.id);
|
|
}
|
|
|
|
function value_28699(a0) { // fn#28699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:4621, offset: 0x00f80947, size: 392 bytes, params: 2, frame: 17
|
|
const value = environment.__proto__;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const object2 = {};
|
|
let can = this.can;
|
|
const MANAGE_GUILD = Permissions.MANAGE_GUILD;
|
|
object2.canManageGuild = Reflect.apply(can, this, [MANAGE_GUILD, a0]);
|
|
can = this.can;
|
|
const MANAGE_CHANNELS = Permissions.MANAGE_CHANNELS;
|
|
object2.canManageChannels = Reflect.apply(can, this, [MANAGE_CHANNELS, a0]);
|
|
can = this.can;
|
|
const MANAGE_ROLES = Permissions.MANAGE_ROLES;
|
|
object2.canManageRoles = Reflect.apply(can, this, [MANAGE_ROLES, a0]);
|
|
can = this.can;
|
|
const BAN_MEMBERS = Permissions.BAN_MEMBERS;
|
|
object2.canManageBans = Reflect.apply(can, this, [BAN_MEMBERS, a0]);
|
|
can = this.can;
|
|
const MANAGE_NICKNAMES = Permissions.MANAGE_NICKNAMES;
|
|
object2.canManageNicknames = Reflect.apply(can, this, [MANAGE_NICKNAMES, a0]);
|
|
can = this.can;
|
|
const MANAGE_GUILD_EXPRESSIONS = Permissions.MANAGE_GUILD_EXPRESSIONS;
|
|
object2.canManageGuildExpressions = Reflect.apply(can, this, [MANAGE_GUILD_EXPRESSIONS,
|
|
a0]) || this.can(Permissions.CREATE_GUILD_EXPRESSIONS, a0);
|
|
can = this.can;
|
|
let VIEW_AUDIT_LOG = Permissions.VIEW_AUDIT_LOG;
|
|
object2.canViewAuditLog = Reflect.apply(can, this, [VIEW_AUDIT_LOG, a0]);
|
|
can = this.can;
|
|
VIEW_AUDIT_LOG = Permissions.VIEW_AUDIT_LOG;
|
|
object2.canViewAuditLogV2 = Reflect.apply(can, this, [VIEW_AUDIT_LOG, a0]);
|
|
can = this.can;
|
|
const MANAGE_WEBHOOKS = Permissions.MANAGE_WEBHOOKS;
|
|
object2.canManageWebhooks = Reflect.apply(can, this, [MANAGE_WEBHOOKS, a0]);
|
|
can = this.can;
|
|
const VIEW_GUILD_ANALYTICS = Permissions.VIEW_GUILD_ANALYTICS;
|
|
object2.canViewGuildAnalytics = Reflect.apply(can, this, [VIEW_GUILD_ANALYTICS, a0]);
|
|
object2.canAccessMembersPage = this.canAccessMemberSafetyPage(a0);
|
|
can = this.can;
|
|
const ADMINISTRATOR = Permissions.ADMINISTRATOR;
|
|
object2.isGuildAdmin = Reflect.apply(can, this, [ADMINISTRATOR, a0]);
|
|
object2.isOwner = currentUser != null && isGuildOwner(a0, currentUser);
|
|
object2.isOwnerWithRequiredMfaLevel = currentUser != null && isGuildOwnerWithRequiredMfaLevel(a0, currentUser);
|
|
object2.guild = a0;
|
|
return object2;
|
|
}
|
|
|
|
function value_28701({id}) { // fn#28701, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:5507, offset: 0x00f80b0b, size: 74 bytes, params: 2, frame: 16
|
|
let value = environment.__proto__;
|
|
const bigFlagUtilsModule = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
const hasAny = bigFlagUtilsModule.hasAny;
|
|
value = _getGuildPermissions(id);
|
|
const VIEW_GUILD_SETTINGS = (importAll(3789) /* metro dependency 3789: PermissionUtils */).VIEW_GUILD_SETTINGS;
|
|
return Reflect.apply(hasAny, bigFlagUtilsModule, [value, VIEW_GUILD_SETTINGS]);
|
|
}
|
|
|
|
function value_28702(a0, a1) { // fn#28702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:5638, offset: 0x00f80b55, size: 139 bytes, params: 3, frame: 17
|
|
var r0;
|
|
var value;
|
|
var can;
|
|
if ('channelId' in a1) {
|
|
if (typeof a1.channelId === 'string') {
|
|
can = this.can;
|
|
value = environment.__proto__;
|
|
value = Reflect.apply(can, this, [a0, ChannelStore.getChannel(a1.channelId)]);
|
|
r0 = value;
|
|
} else {
|
|
value = 'guildId' in a1;
|
|
r0 = value && typeof a1.guildId === 'string';
|
|
if (r0) {
|
|
can = this.can;
|
|
value = environment.__proto__;
|
|
value = Reflect.apply(can, this, [a0, GuildStore.getGuild(a1.guildId)]);
|
|
r0 = value;
|
|
}
|
|
}
|
|
} else {
|
|
value = 'guildId' in a1;
|
|
r0 = value && typeof a1.guildId === 'string';
|
|
if (r0) {
|
|
can = this.can;
|
|
value = environment.__proto__;
|
|
value = Reflect.apply(can, this, [a0, GuildStore.getGuild(a1.guildId)]);
|
|
r0 = value;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_28703(a0, a1, a2, a3, a4) { // fn#28703, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:5838, offset: 0x00f80be0, size: 63 bytes, params: 6, frame: 18
|
|
const value = environment.__proto__;
|
|
return (importAll(483) /* metro dependency 483: BigFlagUtils */).has(_computePermissions(a1, a2, a3, a4), a0);
|
|
}
|
|
|
|
function value_28704(a0, a1, a2, a3, a4) { // fn#28704, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:5950, offset: 0x00f80c1f, size: 147 bytes, params: 6, frame: 22
|
|
var r0;
|
|
var moduleValue;
|
|
var has;
|
|
var value2;
|
|
let value = environment.__proto__;
|
|
if ('basicPermissions' in a1) {
|
|
value = importDefault(3792) /* metro dependency 3792: BasicPermissionUtils */;
|
|
value = value.has(a1.basicPermissions, a0);
|
|
r0 = value;
|
|
} else {
|
|
moduleValue = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
has = moduleValue.has;
|
|
value2 = _computePermissions(a1, a2, a3, a4);
|
|
value = importDefault(3792) /* metro dependency 3792: BasicPermissionUtils */;
|
|
value = Reflect.apply(has, moduleValue, [value2, value.asBigFlag(a0)]);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_28706(a0) { // fn#28706, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6227, offset: 0x00f80ccd, size: 69 bytes, params: 2, frame: 13
|
|
var r0;
|
|
var value;
|
|
var defaultImport;
|
|
if ('basicPermissions' in a0) {
|
|
r0 = a0.basicPermissions;
|
|
} else {
|
|
value = environment.__proto__;
|
|
defaultImport = importDefault(3792) /* metro dependency 3792: BasicPermissionUtils */;
|
|
value = defaultImport.asBasicFlag(_computePermissions(a0));
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_28707(a0, a1, a2) { // fn#28707, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6361, offset: 0x00f80d12, size: 224 bytes, params: 4, frame: 21
|
|
var r5;
|
|
var r0;
|
|
var moduleValue;
|
|
var highestRole;
|
|
var value6;
|
|
let value = a1;
|
|
const r1 = value instanceof UserRecord ? value.id : value;
|
|
const isGuildOwnerBinding = isGuildOwner;
|
|
value = undefined;
|
|
if (!isGuildOwnerBinding(a2, r1)) {
|
|
var currentUser = UserStore.getCurrentUser();
|
|
if (this.can(a0, a2)) {
|
|
if (currentUser != null) {
|
|
moduleValue = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
r5 = moduleValue.getHighestRole(a2, currentUser.id);
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
highestRole = (importAll(3789) /* metro dependency 3789: PermissionUtils */).getHighestRole(a2, r1);
|
|
value6 = currentUser != null;
|
|
if (value6) {
|
|
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
value = value.isRoleHigher(a2, currentUser.id, r5, highestRole);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value6;
|
|
}
|
|
return r0;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function value_28708(a0) { // fn#28708, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6643, offset: 0x00f80df2, size: 69 bytes, params: 2, frame: 14
|
|
var r0;
|
|
let value = environment.__proto__;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const value3 = null;
|
|
if (value3 != currentUser) {
|
|
value = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
value = value.getHighestRole(a0, currentUser.id);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value3;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_28709(a0, a1, a2) { // fn#28709, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:6761, offset: 0x00f80e37, size: 109 bytes, params: 4, frame: 18
|
|
let value = environment.__proto__;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const isViewingRoles2 = ImpersonateStore.isViewingRoles(a0.id);
|
|
value = undefined;
|
|
const permissionUtilsModule = importAll(3789) /* metro dependency 3789: PermissionUtils */;
|
|
return permissionUtilsModule.isRoleHigher(a0, isViewingRoles2 || currentUser == null ? value : currentUser.id, a1,
|
|
a2);
|
|
}
|
|
|
|
function value_28711(a0) { // fn#28711, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:7123, offset: 0x00f80f1b, size: 30 bytes, params: 2, frame: 3
|
|
const value = environment.__proto__;
|
|
return env1_26[a0] ?? 0;
|
|
}
|
|
|
|
function _fun28685(a0) { // fn#28685, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3911:2875, offset: 0x00f8035a, size: 23 bytes, params: 2, frame: 11
|
|
return a0.some(function(a0) {
|
|
return a0.thread != null;
|
|
});
|
|
}
|
|
|