You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.0 KiB
27 lines
1.0 KiB
//- Common routines for all views
|
|
-
|
|
function formatCount (count) {
|
|
return numeral(count).format((count > 1000) ? '0,0.0a' : '0,0');
|
|
}
|
|
|
|
function getUserPictureUrl (userProfile, which) {
|
|
if (!userProfile || !userProfile.picture || !userProfile.picture[which]) {
|
|
return `https://${site.domain}/img/default-member.png`;
|
|
}
|
|
return `https://${site.domain}/image/${userProfile.picture[which]._id}`;
|
|
}
|
|
|
|
function getUserFlags (user) {
|
|
const fA = `${user.flags.isAdmin ? 'A' : '-'}`;
|
|
const fM = `${user.flags.isModerator ? 'M' : '-'}`;
|
|
const fE = `${user.flags.isEmailVerified ? 'E' : '-'}`;
|
|
const fG = `${user.flags.isCloaked ? 'G' : '-'}`;
|
|
|
|
const pL = `${user.permissions.canLogin ? 'L' : '-'}`;
|
|
const pC = `${user.permissions.canChat ? 'C' : '-'}`;
|
|
const pO = `${user.permissions.canComment ? 'O' : '-'}`;
|
|
const pR = `${user.permissions.canReport ? 'R' : '-'}`;
|
|
const pI = `${user.permissions.canShareLinks ? 'I' : '-'}`;
|
|
|
|
return `${fA}${fM}${fE}${fG} ${pL}${pC}${pO}${pR}${pI}`;
|
|
}
|