Skip to content

Commit

Permalink
Merge pull request #14324 from opf/fix/51413/meeting-add-button
Browse files Browse the repository at this point in the history
Show meeting add button when user has permission in any project
  • Loading branch information
aaron-contreras authored Dec 5, 2023
2 parents 05a01a5 + 611c468 commit d4ddc67
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def initialize(work_package:)
private

def allowed_to_add_to_meeting?
User.current.allowed_in_project?(:manage_agendas, @work_package.project)
User.current.allowed_in_any_project?(:manage_agendas)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
meetings_tab.expect_tab_not_present
end

context 'when the user has permission in another project' do
context 'when the user has permission to view in another project' do
let(:other_project) { create(:project, enabled_module_names: %w[meetings]) }

let(:user) do
Expand All @@ -151,10 +151,32 @@
})
end

it 'does show the tab' do
it 'does show the tab, but does not show the button' do
work_package_page.visit!

meetings_tab.expect_tab_present
switch_to_meetings_tab
meetings_tab.expect_add_to_meeting_button_not_present
end
end

context 'when the user has permission to manage in another project' do
let(:other_project) { create(:project, enabled_module_names: %w[meetings]) }

let(:user) do
create(:user,
member_with_permissions: {
project => %i(view_work_packages),
other_project => %i(view_work_packages view_meetings manage_agendas)
})
end

it 'does show the tab and shows the add button' do
work_package_page.visit!

meetings_tab.expect_tab_present
switch_to_meetings_tab
meetings_tab.expect_add_to_meeting_button_present
end
end
end
Expand Down

0 comments on commit d4ddc67

Please sign in to comment.