diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb index 33bdb9cd0d25..aae9167edf7e 100644 --- a/config/initializers/menus.rb +++ b/config/initializers/menus.rb @@ -43,6 +43,7 @@ menu.push :activity, { controller: "/activities", action: "index" }, context: :modules, + if: Proc.new { User.current.logged? || !Setting.login_required? }, icon: "history" menu.push :work_packages, diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb index 059b72f2b604..331a64a11f4f 100644 --- a/lib/redmine/menu_manager/top_menu_helper.rb +++ b/lib/redmine/menu_manager/top_menu_helper.rb @@ -214,8 +214,9 @@ def more_top_menu_items end def module_top_menu_item_groups - items = more_top_menu_items item_groups = [] + items = more_top_menu_items + return item_groups if items.blank? # add untitled group, if no heading is present unless items.first.heading? diff --git a/spec/features/menu_items/top_menu_item_spec.rb b/spec/features/menu_items/top_menu_item_spec.rb index 16612c19ad4f..99ed9849a026 100644 --- a/spec/features/menu_items/top_menu_item_spec.rb +++ b/spec/features/menu_items/top_menu_item_spec.rb @@ -67,7 +67,7 @@ def click_link_in_open_menu(title) end describe "Modules" do - let!(:top_menu) { find("[title=#{I18n.t('label_modules')}]") } + let(:top_menu) { find("[title=#{I18n.t('label_modules')}]") } shared_let(:menu_link_item) { Struct.new(:label, :path) } @@ -139,6 +139,8 @@ def click_link_in_open_menu(title) let(:user) { create(:anonymous) } context "when login_required", with_settings: { login_required: true } do + let(:open_menu) { false } + it "redirects to login" do expect(page).to have_current_path /login/ end