decord/source/modules/guild_settings/GuildRoleMemberActionCreators.tsx

177 lines
5.4 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 5465
// Function ID: 5466
2026-07-20 16:05:17 +00:00
// Name: _fetchMemberCountsFromBackend
2026-08-25 06:04:03 +00:00
// Dependencies: [5, 5464, 676, 709, 530, 1405, 5338, 2]
2026-07-20 16:05:17 +00:00
// Exports: fetchMemberCounts, requestMembersForRole
2026-08-25 06:04:03 +00:00
// Module 5465 (_fetchMemberCountsFromBackend)
2026-08-24 06:08:38 +00:00
import privDefault from "priv" /* 1405 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "getRoleMemberCount" /* 5464 */;
2026-08-24 06:08:38 +00:00
import { Endpoints } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
function _fetchMemberCountsFromBackend() {
const self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c5 = 0;
c6 = 0;
c4 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0, body) {
2026-08-24 06:08:38 +00:00
dependencyMap = tmp3;
c4 = 1;
obj1 = { type: "GUILD_ROLE_MEMBER_COUNT_FETCH_START", guildId: null };
2026-08-04 21:03:28 +00:00
obj1[1] = callback;
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[3]).dispatch(obj1);
const HTTP = callback(closure_1_2[4]).HTTP;
2026-08-04 21:03:28 +00:00
const obj2 = { url: null, rejectWithError: true };
obj2[0] = c5.GUILD_ROLE_MEMBER_COUNTS(callback);
yield HTTP.get(obj2);
if (1 === tmp7) {
c4 = 0;
const obj3 = body(709);
const obj4 = { type: "GUILD_ROLE_MEMBER_COUNT_FETCH_FAILURE", guildId: null };
obj4[1] = callback;
obj3.dispatch(obj4);
2026-08-24 06:08:38 +00:00
c6 = 3;
2026-08-04 21:03:28 +00:00
} else if (arg0 === 1) {
2026-07-29 08:29:29 +00:00
c6 = 3;
2026-08-04 21:03:28 +00:00
throw body;
} else if (arg0 !== 2) {
body = body.body;
const obj = body(709);
const obj5 = { type: "GUILD_ROLE_MEMBER_COUNT_FETCH_SUCCESS", guildId: null, roleMemberCount: null };
obj5[1] = callback;
obj5[2] = body;
obj.dispatch(obj5);
c4 = 0;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
c4 = 0;
return body;
2026-07-29 08:29:29 +00:00
})();
});
2026-08-24 06:08:38 +00:00
closure_6 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
function _fetchMemberCounts() {
let self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c1 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
if (c1 === 2) {
c1 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c1 = 2;
if (0 === c2) {
if (arg0 === 1) {
c1 = 3;
throw arg1;
} else if (arg0 === 2) {
c1 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
if (closure_1_4.shouldFetch(closure_0)) {
2026-07-29 08:29:29 +00:00
c2 = 1;
c1 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
2026-07-29 08:29:29 +00:00
obj1[0] = (function fetchMemberCountsFromBackend(arg0) {
const self = this;
const apply = closure_6.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
})(tmp5);
return obj1;
}
tmp5 = closure_0;
}
} else if (arg0 === 1) {
c1 = 3;
throw arg1;
} else if (arg0 === 2) {
c1 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
}
c1 = 3;
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
} catch (tmp7) {
c1 = tmp;
throw tmp7;
}
}
})();
});
2026-08-24 06:08:38 +00:00
closure_7 = tmp;
2026-07-29 08:29:29 +00:00
let apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
let closure_8 = new privDefault({ maxAge: 10000 });
const tmp2 = new privDefault({ maxAge: 10000 });
let result = require("set").fileFinishedImporting("modules/guild_settings/GuildRoleMemberActionCreators.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const fetchMemberCounts = function fetchMemberCounts(guildId) {
const self = this;
const apply = _fetchMemberCounts.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
export const requestMembersForRole = function requestMembersForRole(closure_0, callback, arg2) {
2026-07-20 16:05:17 +00:00
let flag = arg2;
if (arg2 === undefined) {
flag = true;
}
2026-07-29 08:29:29 +00:00
const combined = "" + closure_0 + "-" + callback;
2026-07-20 16:05:17 +00:00
if (flag) {
2026-08-24 06:08:38 +00:00
if (null != store.get(combined)) {
2026-07-20 16:05:17 +00:00
let resolved = Promise.resolve(null);
}
return resolved;
}
2026-08-24 06:08:38 +00:00
const result = store.set(combined, true);
2026-07-29 08:29:29 +00:00
const _require = closure_0;
const HTTP = _require(530).HTTP;
2026-08-24 06:08:38 +00:00
const obj = { url: Endpoints.GUILD_ROLE_MEMBER_IDS(closure_0, callback), rejectWithError: _require(530).rejectWithMigratedError() };
2026-07-29 08:29:29 +00:00
const value = HTTP.get(obj);
resolved = value.then((body) => {
2026-08-24 06:08:38 +00:00
const membersById = closure_1_1(closure_1_2[6]).requestMembersById(closure_0, body.body, false);
2026-07-29 08:29:29 +00:00
return body.body.length;
});
2026-07-20 16:05:17 +00:00
};