mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
SessionStore: Use an arrow function to avoid this
juggling
This commit is contained in:
parent
de98852da6
commit
5d2c438e3e
1 changed files with 2 additions and 4 deletions
|
@ -19,15 +19,13 @@ SessionStore.prototype.__proto__ = Store.prototype;
|
||||||
SessionStore.prototype.get = function(sid, fn) {
|
SessionStore.prototype.get = function(sid, fn) {
|
||||||
messageLogger.debug('GET ' + sid);
|
messageLogger.debug('GET ' + sid);
|
||||||
|
|
||||||
var self = this;
|
db.get('sessionstorage:' + sid, (err, sess) => {
|
||||||
|
|
||||||
db.get("sessionstorage:" + sid, function(err, sess) {
|
|
||||||
if (sess) {
|
if (sess) {
|
||||||
sess.cookie.expires = 'string' == typeof sess.cookie.expires ? new Date(sess.cookie.expires) : sess.cookie.expires;
|
sess.cookie.expires = 'string' == typeof sess.cookie.expires ? new Date(sess.cookie.expires) : sess.cookie.expires;
|
||||||
if (!sess.cookie.expires || new Date() < sess.cookie.expires) {
|
if (!sess.cookie.expires || new Date() < sess.cookie.expires) {
|
||||||
fn(null, sess);
|
fn(null, sess);
|
||||||
} else {
|
} else {
|
||||||
self.destroy(sid, fn);
|
this.destroy(sid, fn);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fn();
|
fn();
|
||||||
|
|
Loading…
Reference in a new issue