Skip to content

Commit

Permalink
add condition if no ranks
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerESQ committed Dec 5, 2023
1 parent ecb6b5c commit 8a9de84
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions js/src/forum/addUserInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,20 @@ export default function () {
const header_node = vnode.children.find(matchTag('h3'));
const amt = Number(setting('rankAmt')) ?? user.ranks().length;

header_node.children = header_node.children
.concat(
user
.ranks()
.reverse()
.splice(0, amt)
.map((rank) => {
return <span className="Post-Rank">{rankLabel(rank)}</span>;
})
)
.filter(function (el) {
return el.tag !== undefined;
});
if (user.ranks()) {
header_node.children = header_node.children
.concat(
user
.ranks()
.reverse()
.splice(0, amt)
.map((rank) => {
return <span className="Post-Rank">{rankLabel(rank)}</span>;
})
)
.filter(function (el) {
return el.tag !== undefined;
});
}
});
}

0 comments on commit 8a9de84

Please sign in to comment.