SessionStore: Use EC6 class syntax

This fixes a minor bug where the SessionStore constructor did not call
the base class constructor.
This commit is contained in:
Richard Hansen 2020-09-21 17:05:29 -04:00 committed by John McLear
parent 0504e07eb4
commit bee91a0bd1

View file

@ -13,11 +13,8 @@ const log4js = require('ep_etherpad-lite/node_modules/log4js');
const logger = log4js.getLogger('SessionStore');
const SessionStore = module.exports = function SessionStore() {};
SessionStore.prototype.__proto__ = Store.prototype;
SessionStore.prototype.get = function(sid, fn) {
module.exports = class SessionStore extends Store {
get(sid, fn) {
logger.debug('GET ' + sid);
db.get('sessionstorage:' + sid, (err, sess) => {
if (sess) {
@ -32,16 +29,17 @@ SessionStore.prototype.get = function(sid, fn) {
fn();
}
});
};
}
SessionStore.prototype.set = function(sid, sess, fn) {
set(sid, sess, fn) {
logger.debug('SET ' + sid);
db.set('sessionstorage:' + sid, sess);
if (fn) process.nextTick(fn);
};
}
SessionStore.prototype.destroy = function(sid, fn) {
destroy(sid, fn) {
logger.debug('DESTROY ' + sid);
db.remove('sessionstorage:' + sid);
if (fn) process.nextTick(fn);
}
};