37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
// Metro module 5947 (f5948).
|
|
import FriendSuggestionStore from "../friend_suggestions/FriendSuggestionStore";
|
|
import GuildMemberStore from "../../stores/GuildMemberStore";
|
|
import RelationshipStore from "../../stores/RelationshipStore";
|
|
import { RelationshipTypes } from "../../Constants";
|
|
import { stripDiacritics } from "../../utils/StringUtils";
|
|
import UserUtils from "../../utils/UserUtils";
|
|
export function cleanString(a0) {
|
|
return stripDiacritics(a0.toLocaleLowerCase()).trim();
|
|
}
|
|
export function getRelationshipType(a0) {
|
|
const relationshipType = RelationshipStore.getRelationshipType(a0);
|
|
return relationshipType === RelationshipTypes.NONE ? FriendSuggestionStore.getSuggestion(a0) != null ? RelationshipTypes.SUGGESTION : relationshipType : relationshipType;
|
|
}
|
|
export function getNames(a0) {
|
|
const names = {};
|
|
let c15318_0 = names;
|
|
const nickname = RelationshipStore.getNickname(a0.id);
|
|
if (nickname != null) {
|
|
names[nickname] = stripDiacritics(nickname.toLocaleLowerCase()).trim().split(" ");
|
|
}
|
|
const globalName = UserUtils.getGlobalName(a0);
|
|
if (globalName != null && names[globalName] == null) {
|
|
names[globalName] = stripDiacritics(globalName.toLocaleLowerCase()).trim().split(" ");
|
|
}
|
|
names[a0.username] = stripDiacritics(a0.username.toLocaleLowerCase()).trim().split(" ");
|
|
GuildMemberStore.getNicknames(a0.id).forEach((item) => {
|
|
if (c15318_0[item] == null) {
|
|
c15318_0[item] = stripDiacritics(item.toLocaleLowerCase()).trim().split(" ");
|
|
}
|
|
});
|
|
return {
|
|
names,
|
|
nick: nickname
|
|
};
|
|
}
|