check
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
function computeVerifyBadge({ is_verified, license_verified, gold_badge }) {
|
||||
const VERIFIED_BADGES = ['gold', 'green', 'blue']
|
||||
|
||||
// کاربر با تیک طلایی/سبز/آبی «وریفایشده» حساب میشه — محتواش نیازی به تاییدِ
|
||||
// دستیِ پنل نداره و مستقیم توی اپ/وب نمایش داده میشه
|
||||
function isVerifiedBadge (badge) {
|
||||
return VERIFIED_BADGES.includes(badge)
|
||||
}
|
||||
|
||||
function computeVerifyBadge ({ is_verified, license_verified, gold_badge }) {
|
||||
if (gold_badge) return 'gold'
|
||||
if (license_verified) return 'green'
|
||||
if (is_verified === 'verified') return 'blue'
|
||||
@@ -6,7 +14,7 @@ function computeVerifyBadge({ is_verified, license_verified, gold_badge }) {
|
||||
return 'none'
|
||||
}
|
||||
|
||||
function syncVerifyBadge(userDoc) {
|
||||
function syncVerifyBadge (userDoc) {
|
||||
userDoc.verify_badge = computeVerifyBadge({
|
||||
is_verified: userDoc.is_verified,
|
||||
license_verified: userDoc.license_verified,
|
||||
@@ -15,4 +23,4 @@ function syncVerifyBadge(userDoc) {
|
||||
return userDoc.verify_badge
|
||||
}
|
||||
|
||||
module.exports = { computeVerifyBadge, syncVerifyBadge }
|
||||
module.exports = { computeVerifyBadge, syncVerifyBadge, isVerifiedBadge, VERIFIED_BADGES }
|
||||
|
||||
Reference in New Issue
Block a user