decord/source/modules/guild_profile/GuildProfileActionCreators.tsx

224 lines
8.2 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 8897
// Function ID: 8898
2026-07-20 16:05:17 +00:00
// Name: _fetchGuildTopGames
2026-08-05 07:35:12 +00:00
// Dependencies: [5, 4073, 1942, 8895, 676, 709, 530, 5264, 4154, 698, 2]
2026-07-20 16:05:17 +00:00
// Exports: fetchGuildTopGames, getGuildProfile, saveGuildProfile, setGuildProfileVisibility, trackGuildProfileViewed
2026-08-05 07:35:12 +00:00
// Module 8897 (_fetchGuildTopGames)
2026-07-23 10:11:24 +00:00
import dispatcher from "dispatcher";
2026-07-29 08:29:29 +00:00
import handleGatewayJoinRequestUpdate from "handleGatewayJoinRequestUpdate";
import trackCommunicationDisabled from "trackCommunicationDisabled";
import handleUpdateStart from "handleUpdateStart";
import { GuildProfileFetchStatus } from "handleUpdateStart";
2026-07-23 10:11:24 +00:00
import ME from "ME";
2026-07-29 08:29:29 +00:00
let c9;
let metroImportAll;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function _fetchGuildTopGames() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c3 = 0;
let c4 = 0;
return (function*(arg0) {
2026-08-04 21:03:28 +00:00
const table = tmp2;
let closure_1 = tmp5;
const HTTP = lib(outer1_2[6]).HTTP;
const obj1 = { url: null, rejectWithError: null };
obj1[0] = outer1_9.GUILD_TOP_GAMES(lib);
obj1[1] = lib(outer1_2[6]).rejectWithMigratedError();
lib = yield HTTP.get(obj1);
const obj = lib(table[7]);
return obj.buildTopGamesFromServer(lib.body.top_games);
2026-07-29 08:29:29 +00:00
})();
});
const _fetchGuildTopGames = tmp;
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
({ AnalyticEvents: metroImportAll, Endpoints: c9 } = ME);
const result = require("trackCommunicationDisabled").fileFinishedImporting("modules/guild_profile/GuildProfileActionCreators.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const getGuildProfile = function getGuildProfile(outer1_0) {
const _require = outer1_0;
2026-07-20 16:05:17 +00:00
let obj = arg2;
if (arg2 === undefined) {
obj = {};
}
2026-07-29 08:29:29 +00:00
let flag = obj.respectBackoff;
2026-07-20 16:05:17 +00:00
if (flag === undefined) {
flag = false;
}
2026-07-29 08:29:29 +00:00
if (null == outer1_0) {
2026-07-20 16:05:17 +00:00
return Promise.resolve(null);
} else {
2026-07-29 08:29:29 +00:00
const fetchStatus = store.getFetchStatus(outer1_0);
let num = store.getLastSyncTimestamp(outer1_0);
const profile = store.getProfile(outer1_0);
2026-07-20 16:05:17 +00:00
const _Date2 = Date;
const timestamp = Date.now();
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
const diff = timestamp - num;
2026-07-29 08:29:29 +00:00
const nextFetchAllowedAt = store.getNextFetchAllowedAt(outer1_0);
2026-07-20 16:05:17 +00:00
if (flag) {
if (null != nextFetchAllowedAt) {
const _Date = Date;
if (Date.now() < nextFetchAllowedAt) {
let resolved = Promise.resolve(profile);
}
return resolved;
}
}
if (fetchStatus === GuildProfileFetchStatus.FETCHING) {
2026-07-29 08:29:29 +00:00
if (!arg1) {
2026-07-20 16:05:17 +00:00
resolved = Promise.resolve(null);
}
}
if (null != profile) {
if (diff <= 60000) {
2026-07-29 08:29:29 +00:00
if (!arg1) {
2026-07-20 16:05:17 +00:00
let resolved1 = Promise.resolve(profile);
}
}
}
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_PROFILE_FETCH", guildId: null };
obj[1] = outer1_0;
importDefault(709).dispatch(obj);
const HTTP = _require(530).HTTP;
obj = { url: null, rejectWithError: null };
obj[0] = closure_9.GUILD_PROFILE(outer1_0);
const obj2 = importDefault(709);
2026-07-20 16:05:17 +00:00
const obj6 = store;
2026-07-29 08:29:29 +00:00
obj[1] = _require(530).rejectWithMigratedError();
2026-07-20 16:05:17 +00:00
const value = HTTP.get(obj);
2026-07-29 08:29:29 +00:00
const obj5 = _require(530);
2026-07-20 16:05:17 +00:00
resolved1 = value.then((body) => {
2026-07-29 08:29:29 +00:00
let obj = outer1_0(outer1_2[7]);
2026-07-20 16:05:17 +00:00
const guildProfileFromServer = obj.buildGuildProfileFromServer(body.body);
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_PROFILE_FETCH_SUCCESS", guildId: outer1_0, profile: guildProfileFromServer };
2026-07-23 10:11:24 +00:00
outer1_1(outer1_2[5]).dispatch(obj);
2026-07-20 16:05:17 +00:00
return guildProfileFromServer;
}).catch((arg0) => {
2026-07-29 08:29:29 +00:00
const aPIError = new outer1_0(outer1_2[8]).APIError(arg0);
2026-07-23 10:11:24 +00:00
let obj = outer1_1(outer1_2[5]);
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_PROFILE_FETCH_FAILURE", guildId: outer1_0, error: aPIError };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
return null;
});
const nextPromise = value.then((body) => {
2026-07-29 08:29:29 +00:00
let obj = outer1_0(outer1_2[7]);
2026-07-20 16:05:17 +00:00
const guildProfileFromServer = obj.buildGuildProfileFromServer(body.body);
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_PROFILE_FETCH_SUCCESS", guildId: outer1_0, profile: guildProfileFromServer };
2026-07-23 10:11:24 +00:00
outer1_1(outer1_2[5]).dispatch(obj);
2026-07-20 16:05:17 +00:00
return guildProfileFromServer;
});
}
};
2026-07-29 08:29:29 +00:00
export const saveGuildProfile = function saveGuildProfile(outer1_0, name) {
const _require = outer1_0;
if (store.getIsUpdating(outer1_0)) {
2026-07-20 16:05:17 +00:00
let resolved = Promise.resolve(null);
} else {
2026-07-29 08:29:29 +00:00
let obj = importDefault(709);
obj = { type: "GUILD_PROFILE_UPDATE", guildId: null, updates: null };
obj[1] = outer1_0;
obj[2] = name;
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
const HTTP = _require(530).HTTP;
obj = { url: null, body: null, rejectWithError: null };
obj[0] = closure_9.GUILD_PROFILE(outer1_0);
2026-08-05 07:35:12 +00:00
obj[1] = _require(5264).buildGuildProfileUpdateForServer(name);
const obj4 = _require(5264);
2026-07-29 08:29:29 +00:00
obj[2] = _require(530).rejectWithMigratedError();
const obj5 = _require(530);
2026-07-20 16:05:17 +00:00
const patchResult = HTTP.patch(obj);
resolved = HTTP.patch(obj).then((body) => {
2026-07-29 08:29:29 +00:00
let obj = outer1_0(outer1_2[7]);
2026-07-20 16:05:17 +00:00
const guildProfileFromServer = obj.buildGuildProfileFromServer(body.body);
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_PROFILE_UPDATE_SUCCESS", guildId: outer1_0, profile: guildProfileFromServer };
2026-07-23 10:11:24 +00:00
outer1_1(outer1_2[5]).dispatch(obj);
2026-07-20 16:05:17 +00:00
return guildProfileFromServer;
}).catch((arg0) => {
2026-07-29 08:29:29 +00:00
const aPIError = new outer1_0(outer1_2[8]).APIError(arg0);
2026-07-23 10:11:24 +00:00
let obj = outer1_1(outer1_2[5]);
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_PROFILE_UPDATE_FAILURE", guildId: outer1_0, error: aPIError };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
return null;
});
const nextPromise = HTTP.patch(obj).then((body) => {
2026-07-29 08:29:29 +00:00
let obj = outer1_0(outer1_2[7]);
2026-07-20 16:05:17 +00:00
const guildProfileFromServer = obj.buildGuildProfileFromServer(body.body);
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_PROFILE_UPDATE_SUCCESS", guildId: outer1_0, profile: guildProfileFromServer };
2026-07-23 10:11:24 +00:00
outer1_1(outer1_2[5]).dispatch(obj);
2026-07-20 16:05:17 +00:00
return guildProfileFromServer;
});
}
return resolved;
};
2026-07-29 08:29:29 +00:00
export const setGuildProfileVisibility = function setGuildProfileVisibility(outer1_0) {
const _require = outer1_0;
if (store.getIsUpdating(outer1_0)) {
2026-07-20 16:05:17 +00:00
let resolved = Promise.resolve(null);
} else {
2026-07-29 08:29:29 +00:00
let obj = importDefault(709);
obj = { type: "GUILD_PROFILE_UPDATE_VISIBILITY", guildId: null, visibility: null };
obj[1] = outer1_0;
obj[2] = arg1;
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
const HTTP = _require(530).HTTP;
obj = { url: null, body: null, rejectWithError: null };
obj[0] = closure_9.GUILD_PROFILE_VISIBILITY(outer1_0);
const obj1 = { visibility: null };
obj1[0] = arg1;
obj[1] = obj1;
obj[2] = _require(530).rejectWithMigratedError();
const obj5 = _require(530);
2026-07-20 16:05:17 +00:00
const putResult = HTTP.put(obj);
resolved = HTTP.put(obj).then((body) => {
const visibility = body.body.visibility;
2026-07-23 10:11:24 +00:00
let obj = outer1_1(outer1_2[5]);
obj = { type: "GUILD_PROFILE_UPDATE_VISIBILITY_SUCCESS", guildId: closure_0, visibility };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
return visibility;
}).catch((arg0) => {
2026-07-29 08:29:29 +00:00
const aPIError = new outer1_0(outer1_2[8]).APIError(arg0);
2026-07-23 10:11:24 +00:00
let obj = outer1_1(outer1_2[5]);
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_PROFILE_UPDATE_VISIBILITY_FAILURE", guildId: outer1_0, error: aPIError };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
throw aPIError;
});
const nextPromise = HTTP.put(obj).then((body) => {
const visibility = body.body.visibility;
2026-07-23 10:11:24 +00:00
let obj = outer1_1(outer1_2[5]);
obj = { type: "GUILD_PROFILE_UPDATE_VISIBILITY_SUCCESS", guildId: closure_0, visibility };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
return visibility;
});
}
return resolved;
};
export const fetchGuildTopGames = function fetchGuildTopGames() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _fetchGuildTopGames.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-08-04 08:36:32 +00:00
export const trackGuildProfileViewed = function trackGuildProfileViewed(guildId, analyticsLocations) {
const tmp = null != selfMember.getSelfMember(guildId);
2026-07-29 08:29:29 +00:00
let obj = importDefault(698);
2026-08-04 08:36:32 +00:00
obj = { guild_id: guildId, location_stack: analyticsLocations, is_member: tmp, has_join_request: null != request.getRequest(guildId) };
2026-07-20 16:05:17 +00:00
obj.track(constants.GUILD_PROFILE_VIEWED, obj);
};