mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
ref https://github.com/TryGhost/Team/issues/1667 Introducing 2 new helper handlebars tags, `{{total_members}}` and `{{total_paid_members}}` ideal for Member Sites who want to display these metrics to incentivise users to upgrade.
16 lines
544 B
JavaScript
16 lines
544 B
JavaScript
// {{total_paid_members}} helper
|
|
|
|
const {SafeString} = require('../services/handlebars');
|
|
const {memberCountRounding, getMemberStats} = require('../utils/member-count');
|
|
|
|
module.exports = async function total_paid_members () { //eslint-disable-line
|
|
if (this.paid) {
|
|
return new SafeString(memberCountRounding(this.paid));
|
|
} else {
|
|
let memberStats = await getMemberStats();
|
|
const {paid} = memberStats;
|
|
return new SafeString(paid > 0 ? memberCountRounding(paid) : 0);
|
|
}
|
|
};
|
|
|
|
module.exports.async = true;
|