olexnzarov / telegraf-session-mongodb

MongoDB session middleware for Telegraf
25 stars 14 forks source link

bugfix: Middleware would fail if ctx.from is undefined #7

Closed levz0r closed 3 years ago

levz0r commented 4 years ago

In a case of anonymous poll answer, the form object is undefined, therefor we can't rely on the id in it. When this happens, skip saveSession().

levz0r commented 4 years ago

Worth mentioning that if the next middleware relies on ctx.session, it will fail. Therefor, it is developers' responsibility to check ctx.session for existance.