Skip to content

Commit

Permalink
refactor: only the main menu is depth 0
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Sep 20, 2018
1 parent 09f91a1 commit 975105b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inline-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class TelegrafInlineMenu {
}
const actionCode = new ActionCode(options.actionCode || 'main')
delete options.actionCode
options.depth = 0
options.hasMainMenu = actionCode.get() === 'main'
options.depth = options.hasMainMenu ? 0 : 1
// Debug
// options.log = (...args) => console.log(new Date(), ...args)
options.log = options.log || (() => {})
Expand Down Expand Up @@ -374,7 +374,7 @@ function generateBackButtonsAsNeeded(actionCode, {
return []
}
const buttons = []
if (depth >= (hasMainMenu ? 2 : 1) && backButtonText) {
if (depth > 1 && backButtonText) {
buttons.push({
text: backButtonText,
action: actionCode.parent().get(),
Expand Down

0 comments on commit 975105b

Please sign in to comment.