OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Merge remote-tracking branch 'origin/dev' into implementation/50193-fix-role-class-hierarchy
ulferts4a62ab906171
diff --cc spec/features/work_packages/attachments/attachment_upload_spec.rbindex 2b78e4e1705,8e94171e27b..2d68de03b8a--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb@@@ -89,17 -85,43 +85,43 @@@ RSpec.describe 'Upload attachment to woendlet(:editor) { Components::WysiwygEditor.new '.work-packages--activity--add-comment' }- it 'can open the editor to add an image, but image upload is not shown' do- # Add comment- comment_field.activate!+ context 'with a user that is not allowed to add images (Regression #28541)' do+ let(:role) do- create(:role,++ create(:project_role,+ permissions: %i[view_work_packages add_work_packages add_work_package_notes])+ end++ it 'can open the editor to add an image, but image upload is not shown' do+ # Add comment+ comment_field.activate!++ # Button should be hidden+ editor.expect_no_button 'Insert image'++ editor.click_and_type_slowly 'this is a comment!1'+ comment_field.submit_by_click++ wp_page.expect_comment text: 'this is a comment!1'+ end+ end++ context 'with a user that is allowed add attachments but not edit WP (#29203)' do+ let(:role) do- create(:role,++ create(:project_role,+ permissions: %i[view_work_packages add_work_package_attachments add_work_package_notes])+ end++ it 'can open the editor and image upload is shown' do+ comment_field.activate!- # Button should be hidden- editor.expect_no_button 'Insert image'+ editor.expect_button 'Insert image'- editor.click_and_type_slowly 'this is a comment!1'- comment_field.submit_by_click+ editor.click_and_type_slowly 'this is a comment!2'+ editor.drag_attachment image_fixture.path, 'Some image caption'+ comment_field.submit_by_click- wp_page.expect_comment text: 'this is a comment!1'+ wp_page.expect_comment text: 'this is a comment!2'+ endendendend@@@ -247,31 -269,45 +269,45 @@@enddescribe 'attachment dropzone' do- it 'can drag something to the files tab and have it open' do- wp_page.expect_tab 'Activity'- attachments.drag_and_drop_file test_selector('op-attachments--drop-box'),- image_fixture.path,- :center,- page.find('[data-qa-tab-id="files"]'),- delay_dragleave: true-- expect(page).to have_test_selector('op-files-tab--file-list-item-title', text: 'image.png', wait: 10)- editor.wait_until_upload_progress_toaster_cleared- wp_page.expect_tab 'Files'+ shared_examples 'attachment dropzone common' do+ it 'can drag something to the files tab and have it open' do+ wp_page.expect_tab 'Activity'+ attachments.drag_and_drop_file test_selector('op-attachments--drop-box'),+ image_fixture.path,+ :center,+ page.find('[data-qa-tab-id="files"]'),+ delay_dragleave: true++ expect(page).to have_test_selector('op-files-tab--file-list-item-title', text: 'image.png', wait: 10)+ editor.wait_until_upload_progress_toaster_cleared+ wp_page.expect_tab 'Files'+ end++ it 'can drag something from the files tab and create a comment with it' do+ wp_page.switch_to_tab(tab: 'files')++ attachments.drag_and_drop_file '.work-package-comment',+ image_fixture.path,+ :center,+ page.find('[data-qa-tab-id="activity"]'),+ delay_dragleave: true++ wp_page.expect_tab 'Activity'+ endend- it 'can drag something from the files tab and create a comment with it' do- wp_page.switch_to_tab(tab: 'files')+ include_examples 'attachment dropzone common'- attachments.drag_and_drop_file '.work-package-comment',- image_fixture.path,- :center,- page.find('[data-qa-tab-id="activity"]'),- delay_dragleave: true+ context 'with a user that is allowed to add attachments but not edit WP (#29203)' do+ let(:role) do- create(:role,++ create(:project_role,+ permissions: %i[view_work_packages add_work_package_attachments add_work_package_notes])+ end- wp_page.expect_tab 'Activity'+ include_examples 'attachment dropzone common'end+ # This one is not shared, because it requires edit WPit 'can upload an image via attaching and drag & drop' dowp_page.switch_to_tab(tab: 'files')container = page.find_test_selector('op-attachments--drop-box')diff --cc spec/requests/api/v3/attachments_spec.rbindex c7c3dd509c4,9c1fc008b06..e2037975277--- a/spec/requests/api/v3/attachments_spec.rb+++ b/spec/requests/api/v3/attachments_spec.rb@@@ -37,21 -37,13 +37,13 @@@ RSpec.describe API::V3::Attachments::Atlet(:current_user) { create(:user, member_in_project: project, member_through_role: role) }let(:project) { create(:project, public: false) }- let(:role) { create(:role, permissions:) }+ let(:role) { create(:project_role, permissions:) }let(:permissions) { [:add_work_packages] }- context(- 'with missing permissions',- with_config: {- attachments_storage: :fog,- fog: { credentials: { provider: 'AWS' } }- }- ) do- let(:permissions) { [] }-+ describe 'permissions', :with_direct_uploads dolet(:request_path) { api_v3_paths.prepare_new_attachment_upload }let(:request_parts) { { metadata: metadata.to_json, file: } }- let(:metadata) { { fileName: 'cat.png' } }+ let(:metadata) { { fileName: 'cat.png', fileSize: file.size, contentType: 'image/png' } }let(:file) { mock_uploaded_file(name: 'original-filename.txt') }before dodiff --cc spec/requests/api/v3/work_packages/update_resource_spec.rbindex 79a24e71e36,748738998e4..645af0a8259--- a/spec/requests/api/v3/work_packages/update_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/update_resource_spec.rb@@@ -83,7 -83,7 +83,7 @@@ RSpec.describe 'API v3 Work package resendcontext 'no permission to edit the work package' do- let(:role) { create(:project_role, permissions: [:view_work_packages]) }- let(:role) { create(:role, permissions: %i[view_work_packages add_work_package_attachments]) }++ let(:role) { create(:project_role, permissions: %i[view_work_packages add_work_package_attachments]) }let(:current_user) docreate(:user,member_in_project: work_package.project,