Skip to content

Commit

Permalink
make sure hasCancelled and hasNotCancelled return a boolean result
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed Oct 18, 2018
1 parent 9cb63a7 commit c06cce2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions website/server/models/group.js
Expand Up @@ -1421,12 +1421,12 @@ schema.methods.isSubscribed = function isSubscribed () {

schema.methods.hasNotCancelled = function hasNotCancelled () {
let plan = this.purchased.plan;
return this.isSubscribed() && !plan.dateTerminated;
return Boolean(this.isSubscribed() && !plan.dateTerminated);
};

schema.methods.hasCancelled = function hasNotCancelled () {
let plan = this.purchased.plan;
return this.isSubscribed() && plan.dateTerminated;
return Boolean(this.isSubscribed() && plan.dateTerminated);
};

schema.methods.updateGroupPlan = async function updateGroupPlan (removingMember) {
Expand Down
4 changes: 2 additions & 2 deletions website/server/models/user/methods.js
Expand Up @@ -31,12 +31,12 @@ schema.methods.isSubscribed = function isSubscribed () {

schema.methods.hasNotCancelled = function hasNotCancelled () {
let plan = this.purchased.plan;
return this.isSubscribed() && !plan.dateTerminated;
return Boolean(this.isSubscribed() && !plan.dateTerminated);
};

schema.methods.hasCancelled = function hasCancelled () {
let plan = this.purchased.plan;
return this.isSubscribed() && plan.dateTerminated;
return Boolean(this.isSubscribed() && plan.dateTerminated);
};

// Get an array of groups ids the user is member of
Expand Down

0 comments on commit c06cce2

Please sign in to comment.