From c129354ca3aabfa6618d0dd645baf1f092c48f06 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Thu, 6 May 2021 18:27:39 +0300 Subject: [PATCH] Wikipedia: disable 'Clean history' when the history is empty (#7637) --- frontend/apps/reader/modules/readerwikipedia.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerwikipedia.lua b/frontend/apps/reader/modules/readerwikipedia.lua index aafeb7e81..3a0b6e6e9 100644 --- a/frontend/apps/reader/modules/readerwikipedia.lua +++ b/frontend/apps/reader/modules/readerwikipedia.lua @@ -299,14 +299,18 @@ Where do you want them saved?]]) }, { text = _("Clean Wikipedia history"), + enabled_func = function() + return wikipedia_history:has("wikipedia_history") + end, keep_menu_open = true, - callback = function() + callback = function(touchmenu_instance) UIManager:show(ConfirmBox:new{ text = _("Clean Wikipedia history?"), ok_text = _("Clean"), ok_callback = function() -- empty data table to replace current one wikipedia_history:reset{} + touchmenu_instance:updateItems() end, }) end,