Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP#59817 Remove activity menu for anonymous users with login required #17314

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/initializers/menus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion lib/redmine/menu_manager/top_menu_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 3 additions & 1 deletion spec/features/menu_items/top_menu_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down Expand Up @@ -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
Expand Down
Loading