5180 fichiers 38.5 Mo 0 téléchargements 206 vues mis à jour il y a 5 heures ui
nitro-v36-with-renderer-v36 / src / api / user / profileVisibility.ts
profileVisibility.ts 801 o Télécharger le fichier
interface ProfileVisibilityInput {
    id: number;
    isHidden: boolean;
    friendsCount: number;
}

/**
 * "Hide my profile": the server leaves the friend count, groups, last online time and
 * relationships out for other viewers and sends -1 in place of the counts. The owner and
 * moderators get the real values, so only a hidden profile without them is cut here.
 */
export const isProfileHiddenFromViewer = (profile: ProfileVisibilityInput, viewerId: number): boolean =>
    !!profile && profile.isHidden && profile.id !== viewerId && profile.friendsCount < 0;

/** A count or time the server left out (-1) reads as "-". */
export const formatProfileValue = (value: number, hidden: boolean, format: (value: number) => string = String): string =>
    hidden || value < 0 ? '-' : format(value);
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser