telegraf / telegraf-session-firebase

Firebase session for Telegraf
MIT License
14 stars 4 forks source link

Cannot leave scene if there is additional session data #1

Closed Alpvax closed 6 years ago

Alpvax commented 6 years ago

When SceneContext.leave() is called, it removes the __scene property from the session object. But when the session is saved it checks if the session is an empty object, and if so removes it from the database. If it is not an empty object it calls ref.update, which doesn't remove the __scene property from the database. It should call ref.set instead.

snowwm commented 6 years ago

@dotcypress Well, and what are the reasons for using ref.update instead of ref.set? If they are strong, we can add a line to manually set __scene to null if it's undefined, which will effectively remove it from the database.