decord/source/modules/user_profile/maybeFetchUserProfile.tsx

178 lines
5.1 KiB
TypeScript
Raw Normal View History

2026-09-02 09:53:35 +00:00
// Module ID: 8123
// Function ID: 8124
2026-07-20 16:05:17 +00:00
// Name: maybeFetchUserProfile
2026-09-02 09:53:35 +00:00
// Dependencies: [1386, 1991, 7375, 7295, 8050, 5359, 706, 8124, 8125, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-09-02 09:53:35 +00:00
// Module 8123 (maybeFetchUserProfile)
import closure_3 from "ensureGuildLoaded" /* 1386 */;
import closure_4 from "trackCommunicationDisabled" /* 1991 */;
import closure_5 from "createUserWidgetFromServer" /* 7375 */;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/user_profile/maybeFetchUserProfile.tsx");
2026-07-23 10:11:24 +00:00
export default function maybeFetchUserProfile(id, closure_0, guildMember) {
const _require = id;
2026-07-29 08:29:29 +00:00
let obj = guildMember;
2026-07-20 16:05:17 +00:00
if (guildMember === undefined) {
obj = {};
}
({ withMutualGuilds, type } = obj);
if (withMutualGuilds === undefined) {
withMutualGuilds = false;
}
let flag = obj.withMutualFriendsCount;
if (flag === undefined) {
flag = false;
}
let flag2 = obj.withMutualFriends;
if (flag2 === undefined) {
flag2 = false;
}
let flag3 = obj.dispatchWait;
if (flag3 === undefined) {
flag3 = false;
}
let flag4 = obj.waitForRefetch;
if (flag4 === undefined) {
flag4 = true;
}
const guildId = obj.guildId;
2026-07-23 10:11:24 +00:00
obj = undefined;
2026-07-20 16:05:17 +00:00
if ("" === id) {
return Promise.resolve();
2026-07-29 08:29:29 +00:00
} else if (fetchingProfile.isFetchingProfile(id, guildId)) {
2026-07-20 16:05:17 +00:00
return Promise.resolve();
} else {
2026-07-29 08:29:29 +00:00
const userProfile = obj10.getUserProfile(id);
const guildMemberProfile = obj10.getGuildMemberProfile(id, guildId);
let tmp7 = userProfile;
2026-07-20 16:05:17 +00:00
if (null != guildId) {
2026-07-29 08:29:29 +00:00
tmp7 = guildMemberProfile;
2026-07-20 16:05:17 +00:00
}
const _Date = Date;
2026-07-29 08:29:29 +00:00
let num;
2026-07-20 16:05:17 +00:00
const timestamp = Date.now();
2026-07-29 08:29:29 +00:00
if (tmp7 != null) {
num = tmp7.fetchEndedAt;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
let status;
2026-07-29 08:29:29 +00:00
const diff = timestamp - num;
if (tmp7 != null) {
const fetchError = tmp7.fetchError;
if (fetchError != null) {
2026-07-20 16:05:17 +00:00
status = fetchError.status;
}
}
2026-07-29 08:29:29 +00:00
let tmp12 = diff >= 60000;
2026-07-20 16:05:17 +00:00
if (404 === status) {
if (!tmp12) {
return Promise.resolve();
}
} else {
let status1;
2026-07-29 08:29:29 +00:00
if (tmp7 != null) {
const fetchError2 = tmp7.fetchError;
if (fetchError2 != null) {
2026-07-20 16:05:17 +00:00
status1 = fetchError2.status;
}
}
}
2026-07-29 08:29:29 +00:00
const mutualGuilds = obj10.getMutualGuilds(id);
const mutualFriends = obj10.getMutualFriends(id);
const tmp17 = null == guildId ? null == userProfile : null == guildMemberProfile;
let tmp18 = !tmp17;
if (!tmp17) {
2026-07-20 16:05:17 +00:00
if (!tmp12) {
tmp12 = null == mutualGuilds && withMutualGuilds;
2026-07-29 08:29:29 +00:00
const tmp19 = null == mutualGuilds && withMutualGuilds;
2026-07-20 16:05:17 +00:00
}
if (!tmp12) {
tmp12 = null == mutualFriends && flag2;
2026-07-29 08:29:29 +00:00
const tmp20 = null == mutualFriends && flag2;
2026-07-20 16:05:17 +00:00
}
if (!tmp12) {
2026-07-29 08:29:29 +00:00
tmp12 = null == tmp16 && flag;
const tmp21 = null == tmp16 && flag;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp18 = tmp12;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp17) {
if (!tmp18) {
2026-07-20 16:05:17 +00:00
return Promise.resolve();
}
}
if (null != guildId) {
let profileEffect;
2026-07-29 08:29:29 +00:00
if (guildMemberProfile != null) {
2026-07-20 16:05:17 +00:00
profileEffect = guildMemberProfile.profileEffect;
}
2026-07-29 08:29:29 +00:00
} else if (userProfile != null) {
2026-07-20 16:05:17 +00:00
profileEffect = userProfile.profileEffect;
}
if (null != profileEffect) {
2026-09-02 09:53:35 +00:00
const result = _require(7295).maybeFetchCollectiblesProduct(profileEffect.skuId);
const obj2 = _require(7295);
2026-07-20 16:05:17 +00:00
}
if (null != guildId) {
let profileFrame;
2026-07-29 08:29:29 +00:00
if (guildMemberProfile != null) {
2026-07-20 16:05:17 +00:00
profileFrame = guildMemberProfile.profileFrame;
}
2026-07-29 08:29:29 +00:00
} else if (userProfile != null) {
2026-07-20 16:05:17 +00:00
profileFrame = userProfile.profileFrame;
}
if (null != profileFrame) {
2026-09-02 09:53:35 +00:00
const result1 = _require(7295).maybeFetchCollectiblesProduct(profileFrame.skuId);
const obj3 = _require(7295);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (null != closure_0) {
2026-09-02 09:53:35 +00:00
_require(8050).maybeFetchColors(closure_0);
const obj4 = _require(8050);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { type: null, withMutualGuilds: null, withMutualFriends: null, withMutualFriendsCount: null, guildId: null, joinRequestId: null, abortSignal: null, connectionsRoleId: null };
obj[0] = type;
obj[1] = withMutualGuilds;
obj[2] = flag2;
obj[3] = flag;
obj[4] = guildId;
obj[5] = tmp2;
obj[6] = tmp3;
let tmp34;
2026-07-20 16:05:17 +00:00
if (null != guildId) {
2026-07-29 08:29:29 +00:00
obj = { guildMember: null, channel: null };
obj[0] = member.getMember(guildId, id);
obj[1] = channel.getChannel(tmp);
2026-09-02 09:53:35 +00:00
const visibleConnectionsRole = _require(5359).getVisibleConnectionsRole(obj);
2026-07-29 08:29:29 +00:00
id = undefined;
if (visibleConnectionsRole != null) {
2026-07-20 16:05:17 +00:00
id = visibleConnectionsRole.id;
}
2026-07-29 08:29:29 +00:00
tmp34 = id;
2026-09-02 09:53:35 +00:00
const obj6 = _require(5359);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[7] = tmp34;
2026-07-20 16:05:17 +00:00
if (flag3) {
2026-09-02 09:53:35 +00:00
obj(706).wait(() => {
2026-08-24 06:08:38 +00:00
obj = id(closure_1_2[7]);
return obj.fetchProfile(id, obj, obj(closure_1_2[8]));
2026-07-20 16:05:17 +00:00
});
return Promise.resolve();
} else {
2026-09-02 09:53:35 +00:00
const profile = _require(8124).fetchProfile(id, obj, obj(8125));
2026-07-20 16:05:17 +00:00
let resolved = profile;
2026-07-29 08:29:29 +00:00
if (tmp18) {
2026-07-20 16:05:17 +00:00
resolved = profile;
if (!flag4) {
resolved = Promise.resolve();
}
}
return resolved;
}
}
};