1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00

Fixed minor contribution bug

This commit is contained in:
Jon Ziebell 2022-10-16 21:47:08 -04:00
parent 2879d77e3d
commit d9436a68a1
2 changed files with 15 additions and 6 deletions

View File

@ -3,7 +3,7 @@ beestat.user = {};
/** /**
* Determine whether or not the current user is an active Patron. * Determine whether or not the current user is an active Patron.
* *
* @return {boolean} true if yes, false if no. * @return {boolean}
*/ */
beestat.user.patreon_is_active = function() { beestat.user.patreon_is_active = function() {
const user = beestat.user.get(); const user = beestat.user.get();
@ -16,7 +16,7 @@ beestat.user.patreon_is_active = function() {
/** /**
* Determine whether or not the current user is an active Stripe giver. * Determine whether or not the current user is an active Stripe giver.
* *
* @return {boolean} true if yes, false if no. * @return {boolean}
*/ */
beestat.user.stripe_is_active = function() { beestat.user.stripe_is_active = function() {
const stripe_events = Object.values(beestat.cache.stripe_event); const stripe_events = Object.values(beestat.cache.stripe_event);
@ -32,6 +32,16 @@ beestat.user.stripe_is_active = function() {
return false; return false;
}; };
/**
* Determine whether or not hte current user is an active contributor.
*
* @return {boolean}
*/
beestat.user.contribution_is_active = function() {
return beestat.user.patreon_is_active() === true ||
beestat.user.stripe_is_active() === true;
};
/** /**
* Is the user connected to Patreon. * Is the user connected to Patreon.
* *
@ -49,8 +59,7 @@ beestat.user.patreon_is_connected = function() {
beestat.user.has_early_access = function() { beestat.user.has_early_access = function() {
const user = beestat.user.get(); const user = beestat.user.get();
return user.user_id === 1 || return user.user_id === 1 ||
beestat.user.stripe_is_active() === true || beestat.user.contribution_is_active() === true;
beestat.user.patreon_is_active() === true;
}; };
/** /**

View File

@ -21,7 +21,7 @@ beestat.extend(beestat.component.card.contribute, beestat.component.card);
beestat.component.card.contribute.prototype.decorate_contents_ = function(parent) { beestat.component.card.contribute.prototype.decorate_contents_ = function(parent) {
const self = this; const self = this;
if (beestat.user.has_early_access() === true) { if (beestat.user.contribution_is_active() === true) {
const p1 = document.createElement('p'); const p1 = document.createElement('p');
p1.innerText = 'Thank you so much for your support! Your contribution goes a long way towards keeping beestat running and enabling me to create a rich and useful application. My hope is that you are able to use beestat to save money and improve the efficiency of your home.'; p1.innerText = 'Thank you so much for your support! Your contribution goes a long way towards keeping beestat running and enabling me to create a rich and useful application. My hope is that you are able to use beestat to save money and improve the efficiency of your home.';
parent.appendChild(p1); parent.appendChild(p1);
@ -290,7 +290,7 @@ beestat.component.card.contribute.prototype.get_title_ = function() {
* @param {rocket.Elements} parent * @param {rocket.Elements} parent
*/ */
beestat.component.card.contribute.prototype.decorate_top_right_ = function(parent) { beestat.component.card.contribute.prototype.decorate_top_right_ = function(parent) {
if (beestat.user.has_early_access() === false) { if (beestat.user.contribution_is_active() === false) {
const menu = (new beestat.component.menu()).render(parent); const menu = (new beestat.component.menu()).render(parent);
menu.add_menu_item(new beestat.component.menu_item() menu.add_menu_item(new beestat.component.menu_item()