decord/beta/source/modules/user_profile/maybeFetchUserProfile.tsx

165 lines
5 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 8312
// Function ID: 8313
// Name: maybeFetchUserProfile
2026-10-12 16:32:48 +00:00
// Dependencies: [2065, 2125, 7321, 7263, 8269, 6876, 8306, 8313, 2]
// Exports: default
2026-10-12 16:32:48 +00:00
// Module 8312 (maybeFetchUserProfile)
import ConnectionsUtils from "ConnectionsUtils" /* 6876 */;
import CollectiblesActionCreators from "CollectiblesActionCreators" /* 7263 */;
import useAvatarColor from "useAvatarColor" /* 8269 */;
import UserActionCreators from "UserActionCreators" /* 8306 */;
import preloadUserBannerImageDefault from "preloadUserBannerImage" /* 8313 */;
import ChannelStore from "ChannelStore" /* 2065 */;
import GuildMemberStore from "GuildMemberStore" /* 2125 */;
import UserProfileStore from "UserProfileStore" /* 7321 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
let result = size.fileFinishedImporting("modules/user_profile/maybeFetchUserProfile.tsx");
export default function maybeFetchUserProfile(id, guildIconURL) {
2026-10-01 14:13:23 +00:00
let tmp34;
let type;
let withMutualGuilds;
let obj = arg2;
if (arg2 === 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;
}
2026-10-12 16:32:48 +00:00
let flag3 = obj.waitForRefetch;
if (flag3 === undefined) {
2026-10-12 16:32:48 +00:00
flag3 = true;
}
const guildId = obj.guildId;
if ("" === id) {
return Promise.resolve();
} else if (UserProfileStore.isFetchingProfile(id, guildId)) {
return Promise.resolve();
} else {
2026-10-01 14:13:23 +00:00
let profileEffect;
let profileFrame;
2026-10-12 16:32:48 +00:00
const userProfile = obj8.getUserProfile(id);
const guildMemberProfile = obj8.getGuildMemberProfile(id, guildId);
let tmp7 = userProfile;
if (null != guildId) {
tmp7 = guildMemberProfile;
}
const _Date = Date;
let num;
const timestamp = Date.now();
if (tmp7 != null) {
num = tmp7.fetchEndedAt;
}
if (num == null) {
num = 0;
}
let status;
const diff = timestamp - num;
if (tmp7 != null) {
const fetchError = tmp7.fetchError;
if (fetchError != null) {
status = fetchError.status;
}
}
let tmp12 = diff >= 60000;
if (404 === status) {
if (!tmp12) {
return Promise.resolve();
}
} else {
let status1;
if (tmp7 != null) {
const fetchError2 = tmp7.fetchError;
if (fetchError2 != null) {
status1 = fetchError2.status;
}
}
}
2026-10-12 16:32:48 +00:00
const mutualGuilds = obj8.getMutualGuilds(id);
const mutualFriends = obj8.getMutualFriends(id);
const tmp17 = null == guildId ? null == userProfile : null == guildMemberProfile;
let tmp18 = !tmp17;
2026-10-01 14:13:23 +00:00
if (tmp18) {
if (!tmp12) {
tmp12 = null == mutualGuilds && withMutualGuilds;
}
if (!tmp12) {
tmp12 = null == mutualFriends && flag2;
}
if (!tmp12) {
tmp12 = null == tmp16 && flag;
}
tmp18 = tmp12;
}
if (!tmp17) {
if (!tmp18) {
return Promise.resolve();
}
}
if (null != guildId) {
let profileEffect1;
if (guildMemberProfile != null) {
profileEffect1 = guildMemberProfile.profileEffect;
}
2026-10-01 14:13:23 +00:00
profileEffect = profileEffect1;
} else if (userProfile != null) {
profileEffect = userProfile.profileEffect;
}
if (null != profileEffect) {
2026-10-12 16:32:48 +00:00
const obj2 = CollectiblesActionCreators;
2026-10-01 14:13:23 +00:00
const result = obj2.maybeFetchCollectiblesProduct(profileEffect.skuId);
}
if (null != guildId) {
let profileFrame1;
if (guildMemberProfile != null) {
profileFrame1 = guildMemberProfile.profileFrame;
}
2026-10-01 14:13:23 +00:00
profileFrame = profileFrame1;
} else if (userProfile != null) {
profileFrame = userProfile.profileFrame;
}
if (null != profileFrame) {
2026-10-12 16:32:48 +00:00
const obj3 = CollectiblesActionCreators;
2026-10-01 14:13:23 +00:00
const result1 = obj3.maybeFetchCollectiblesProduct(profileFrame.skuId);
}
if (null != guildIconURL) {
2026-10-12 16:32:48 +00:00
const obj4 = useAvatarColor;
2026-10-01 14:13:23 +00:00
obj4.maybeFetchColors(guildIconURL);
}
2026-10-12 16:32:48 +00:00
const obj5 = { type, withMutualGuilds, withMutualFriends: flag2, withMutualFriendsCount: flag, guildId, joinRequestId: tmp2, abortSignal: tmp3, connectionsRoleId: tmp34 };
2026-10-01 14:13:23 +00:00
tmp34 = undefined;
if (null != guildId) {
2026-10-01 14:13:23 +00:00
const obj6 = { guildMember: GuildMemberStore.getMember(guildId, id), channel: ChannelStore.getChannel(tmp) };
2026-10-12 16:32:48 +00:00
const getVisibleConnectionsRole = ConnectionsUtils.getVisibleConnectionsRole;
ConnectionsUtils;
2026-10-01 14:13:23 +00:00
const visibleConnectionsRole = getVisibleConnectionsRole(obj6);
id = undefined;
if (visibleConnectionsRole != null) {
id = visibleConnectionsRole.id;
}
tmp34 = id;
}
2026-10-12 16:32:48 +00:00
const obj7 = UserActionCreators;
const profile = obj7.fetchProfile(id, obj5, preloadUserBannerImageDefault);
let resolved = profile;
if (tmp18) {
resolved = profile;
if (!flag3) {
resolved = Promise.resolve();
}
}
2026-10-12 16:32:48 +00:00
return resolved;
}
};