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
[35506] Avoid notifications for assigned/responsible placeholders
Oliver Günthere4848046454a
diff --git a/app/models/work_package.rb b/app/models/work_package.rbindex e9f159cd38b..486f3b75f84 100644--- a/app/models/work_package.rb+++ b/app/models/work_package.rb@@ -683,9 +683,10 @@ class WorkPackage < ApplicationRecordrelated = [author][responsible, assigned_to].each do |user|- if user.is_a?(Group)+ case user+ when Grouprelated += user.users- else+ when Userrelated << userendenddiff --git a/spec/features/work_packages/tabs/watcher_tab_spec.rb b/spec/features/work_packages/tabs/watcher_tab_spec.rbindex e02f92ea058..d4125f7ed1d 100644--- a/spec/features/work_packages/tabs/watcher_tab_spec.rb+++ b/spec/features/work_packages/tabs/watcher_tab_spec.rb@@ -136,4 +136,23 @@ describe 'Watcher tab', js: true, selenium: true doexpect(page).to have_selector('.wp-tabs-count', text: 1)endend++ context 'with a placeholder user in the project' do+ let!(:placeholder) { FactoryBot.create :placeholder_user, name: 'PLACEHOLDER' }+ let(:wp_page) { Pages::FullWorkPackage.new(work_package) }++ before do+ login_as(user)+ wp_page.visit_tab! :watchers+ end++ it 'should not show the placeholder user as an option' do+ autocomplete = find('.wp-watcher--autocomplete')+ target_dropdown = search_autocomplete autocomplete,+ query: ''++ expect(target_dropdown).to have_selector(".ng-option", text: user.name)+ expect(target_dropdown).to have_no_selector(".ng-option", text: placeholder.name)+ end+ endenddiff --git a/spec/services/notifications/journal_wp_mail_service_spec.rb b/spec/services/notifications/journal_wp_mail_service_spec.rbindex 2da645a0ed2..1de94681d35 100644--- a/spec/services/notifications/journal_wp_mail_service_spec.rb+++ b/spec/services/notifications/journal_wp_mail_service_spec.rb@@ -102,6 +102,25 @@ describe Notifications::JournalWpMailService doit_behaves_like 'sends mail'+ context 'assignee is placeholder user' do+ let(:recipient) { FactoryBot.create :placeholder_user }++ it_behaves_like 'sends no mail'+ end++ context 'responsible is placeholder user' do+ let(:recipient) { FactoryBot.create :placeholder_user }+ let(:work_package) do+ FactoryBot.create(:work_package,+ project: project,+ author: author,+ responsible: recipient,+ type: project.types.first)+ end++ it_behaves_like 'sends no mail'+ end+context 'notification for work_package_added disabled' dolet(:notification_setting) { %w(work_package_updated work_package_note_added) }