julianlam/nodebb-plugin-session-sharing

Cannot read property 'isBanned'

Closed this issue · 2 comments

Hi,

I'm getting this error:

2019-09-18T23:18:27.862Z [26413] - error: message=Cannot read property 'isBanned' of undefined, stack=TypeError: Cannot read property 'isBanned' of undefined

// Error happens here
// Check ban state of user, reject if banned
user.bans.isBanned(uid, function(err, banned) {
  callback(err || banned ? new Error("banned") : null, uid);
});

// This works but of course I want to check if user is banned
// callback(null, uid);

Any idea what's causing the error?

Thanks!

What version of NodeBB are you using? You might need to update to a newer version if isBanned is undefined...

I was using v1.10.2. I upgraded to v1.12.x and the issue went away. Thanks for the tip!