Skip to content

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

[#43675] fix specs

Dmitrii0c85cc428742
diff --git a/app/seeders/admin_user_seeder.rb b/app/seeders/admin_user_seeder.rb
index 29470a0049b..c531b4f8bfd 100644
--- a/app/seeders/admin_user_seeder.rb
+++ b/app/seeders/admin_user_seeder.rb
@@ -55,7 +55,7 @@ class AdminUserSeeder < Seeder
user.language = I18n.locale.to_s
user.status = User.statuses[:active]
user.force_password_change = force_password_change?
- user.notification_settings.build(involved: true, mentioned: true, watched: true)
+ user.notification_settings.build(assignee: true, responsible: true, mentioned: true, watched: true)
end
end
diff --git a/app/seeders/development_data/users_seeder.rb b/app/seeders/development_data/users_seeder.rb
index 8cac0c2d16d..d40985a6fa6 100644
--- a/app/seeders/development_data/users_seeder.rb
+++ b/app/seeders/development_data/users_seeder.rb
@@ -103,7 +103,7 @@ module DevelopmentData
user.status = User.statuses[:active]
user.language = I18n.locale
user.force_password_change = false
- user.notification_settings.build(involved: true, mentioned: true, watched: true)
+ user.notification_settings.build(assignee: true, responsible: true, mentioned: true, watched: true)
end
end
diff --git a/app/services/users/set_attributes_service.rb b/app/services/users/set_attributes_service.rb
index 75ff215f438..9c2dc80bbae 100644
--- a/app/services/users/set_attributes_service.rb
+++ b/app/services/users/set_attributes_service.rb
@@ -62,7 +62,7 @@ module Users
end
def initialize_notification_settings
- model.notification_settings.build(involved: true, mentioned: true, watched: true)
+ model.notification_settings.build(assignee: true, responsible: true, mentioned: true, watched: true)
end
# rubocop:disable Metrics/AbcSize
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
index 3aa7ed212d2..9bbd16fb3d1 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
+++ b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
@@ -30,15 +30,29 @@
</tr>
<tr>
<th class="op-table--cell op-table--cell_soft-heading">
- <h5>{{ text.involved_header.title }}</h5>
- <p>{{ text.involved_header.description }}</p>
+ <h5>{{ text.assignee }}</h5>
</th>
<ng-container *ngFor="let item of settings.controls">
<td class="op-table--cell" [formGroup]="item">
<input
type="checkbox"
- formControlName="involved"
- data-qa-project-notification-type="involved"
+ formControlName="assignee"
+ data-qa-project-notification-type="assignee"
+ [attr.data-qa-project]="item.controls.project.value.title"
+ />
+ </td>
+ </ng-container>
+ </tr>
+ <tr>
+ <th class="op-table--cell op-table--cell_soft-heading">
+ <h5>{{ text.responsible }}</h5>
+ </th>
+ <ng-container *ngFor="let item of settings.controls">
+ <td class="op-table--cell" [formGroup]="item">
+ <input
+ type="checkbox"
+ formControlName="responsible"
+ data-qa-project-notification-type="responsible"
[attr.data-qa-project]="item.controls.project.value.title"
/>
</td>
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
index 38cd81fc1c3..28dfd1faf08 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
@@ -9,7 +9,6 @@ import { FormArray, FormGroup, FormControl } from '@angular/forms';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
-import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';
import { HalSourceLink } from 'core-app/features/hal/resources/hal-resource';
@Component({
@@ -30,10 +29,8 @@ export class NotificationSettingsTableComponent {
title: this.I18n.t('js.notifications.settings.reasons.mentioned.title'),
description: this.I18n.t('js.notifications.settings.reasons.mentioned.description'),
},
- involved_header: {
- title: this.I18n.t('js.notifications.settings.reasons.involved.title'),
- description: this.I18n.t('js.notifications.settings.reasons.involved.description'),
- },
+ assignee: this.I18n.t('js.notifications.settings.reasons.assignee'),
+ responsible: this.I18n.t('js.notifications.settings.reasons.responsible'),
watched_header: this.I18n.t('js.notifications.settings.reasons.watched'),
work_package_commented_header: this.I18n.t('js.notifications.settings.reasons.work_package_commented'),
work_package_created_header: this.I18n.t('js.notifications.settings.reasons.work_package_created'),
@@ -55,7 +52,8 @@ export class NotificationSettingsTableComponent {
addProjectSettings(project:HalSourceLink):void {
this.settings.push(new FormGroup({
project: new FormControl(project),
- involved: new FormControl(false),
+ assignee: new FormControl(false),
+ responsible: new FormControl(false),
workPackageCreated: new FormControl(false),
workPackageProcessed: new FormControl(false),
workPackageScheduled: new FormControl(false),
diff --git a/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb b/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb
index cf8eb98141b..e5829200fa9 100644
--- a/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb
+++ b/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb
@@ -68,10 +68,10 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
end
end
- context 'with the user having registered for involved notifications' do
+ context 'with the user having registered for assignee and responsible notifications' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
@@ -116,10 +116,10 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
end
end
- context 'with the user having registered for involved notifications' do
+ context 'with the user having registered for assignee and responsible notifications' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
diff --git a/spec/features/notifications/reminder_mail_spec.rb b/spec/features/notifications/reminder_mail_spec.rb
index cd1cd2dfec9..b58757d0a8a 100644
--- a/spec/features/notifications/reminder_mail_spec.rb
+++ b/spec/features/notifications/reminder_mail_spec.rb
@@ -36,7 +36,8 @@ describe "Reminder email sending", type: :feature, js: true do
},
notification_settings: [
build(:notification_setting,
- involved: true,
+ assignee: true,
+ responsible: true,
watched: true,
mentioned: true,
work_package_commented: true,
diff --git a/spec/features/users/notifications/shared_examples.rb b/spec/features/users/notifications/shared_examples.rb
index 17ea5bde9df..7eeb576b23d 100644
--- a/spec/features/users/notifications/shared_examples.rb
+++ b/spec/features/users/notifications/shared_examples.rb
@@ -15,7 +15,8 @@ shared_examples 'notification settings workflow' do
settings_page.add_project project_alt
# Set settings for project email
- settings_page.configure_global involved: true,
+ settings_page.configure_global assignee: true,
+ responsible: true,
work_package_commented: true,
work_package_created: true,
work_package_processed: true,
@@ -24,7 +25,8 @@ shared_examples 'notification settings workflow' do
# Set settings for project email
settings_page.configure_project project: project,
- involved: true,
+ assignee: true,
+ responsible: true,
work_package_commented: false,
work_package_created: false,
work_package_processed: false,
@@ -39,7 +41,8 @@ shared_examples 'notification settings workflow' do
expect(notification_settings.where(project:).count).to eq 1
project_settings = notification_settings.find_by(project:)
- expect(project_settings.involved).to be_truthy
+ expect(project_settings.assignee).to be_truthy
+ expect(project_settings.responsible).to be_truthy
expect(project_settings.mentioned).to be_truthy
expect(project_settings.watched).to be_truthy
expect(project_settings.work_package_commented).to be_falsey
diff --git a/spec/lib/api/v3/user_preferences/user_preference_representer_parsing_spec.rb b/spec/lib/api/v3/user_preferences/user_preference_representer_parsing_spec.rb
index 892a9547810..d6745ee8f97 100644
--- a/spec/lib/api/v3/user_preferences/user_preference_representer_parsing_spec.rb
+++ b/spec/lib/api/v3/user_preferences/user_preference_representer_parsing_spec.rb
@@ -43,7 +43,8 @@ describe ::API::V3::UserPreferences::UserPreferenceRepresenter,
{
'notifications' => [
{
- 'involved' => true,
+ 'assignee' => true,
+ 'responsible' => true,
'_links' => {
'project' => {
'href' => '/api/v3/projects/1'
@@ -51,7 +52,8 @@ describe ::API::V3::UserPreferences::UserPreferenceRepresenter,
}
},
{
- 'involved' => false,
+ 'assignee' => false,
+ 'responsible' => false,
'mentioned' => true,
'_links' => {
'project' => {
@@ -69,11 +71,13 @@ describe ::API::V3::UserPreferences::UserPreferenceRepresenter,
in_project, global = subject.notification_settings
expect(in_project[:project_id]).to eq "1"
- expect(in_project[:involved]).to be_truthy
+ expect(in_project[:assignee]).to be_truthy
+ expect(in_project[:responsible]).to be_truthy
expect(in_project[:mentioned]).to be_nil
expect(global[:project_id]).to be_nil
- expect(global[:involved]).to be false
+ expect(global[:assignee]).to be_falsey
+ expect(global[:responsible]).to be_falsey
expect(global[:mentioned]).to be true
end
end
diff --git a/spec/models/mail_handler_spec.rb b/spec/models/mail_handler_spec.rb
index 5ccc3708116..314a02df2f1 100644
--- a/spec/models/mail_handler_spec.rb
+++ b/spec/models/mail_handler_spec.rb
@@ -1071,7 +1071,7 @@ describe MailHandler, type: :model do
assignee = create(:user,
member_in_project: project,
member_with_permissions: %i(view_work_packages),
- notification_settings: [build(:notification_setting, involved: true)])
+ notification_settings: [build(:notification_setting, assignee: true, responsible: true)])
work_package.update_column(:assigned_to_id, assignee.id)
diff --git a/spec/services/notifications/create_from_model_service_comment_spec.rb b/spec/services/notifications/create_from_model_service_comment_spec.rb
index a65cc255322..e651be0b59b 100644
--- a/spec/services/notifications/create_from_model_service_comment_spec.rb
+++ b/spec/services/notifications/create_from_model_service_comment_spec.rb
@@ -73,10 +73,10 @@ describe Notifications::CreateFromModelService, 'comment', with_settings: { jour
end
end
- context 'with the user having registered for involved notifications' do
+ context 'with the user having registered for assignee and responsible notifications' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
diff --git a/spec/services/notifications/create_from_model_service_message_spec.rb b/spec/services/notifications/create_from_model_service_message_spec.rb
index 8be43a0c014..1ffec2fd7ce 100644
--- a/spec/services/notifications/create_from_model_service_message_spec.rb
+++ b/spec/services/notifications/create_from_model_service_message_spec.rb
@@ -74,10 +74,10 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
end
end
- context 'with the user having registered for involved notifications' do
+ context 'with the user having registered for assignee and responsible notifications' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
@@ -206,10 +206,10 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
end
end
- context 'with the user having registered for involved notifications' do
+ context 'with the user having registered for assignee and responsible notifications' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
diff --git a/spec/services/notifications/create_from_model_service_news_spec.rb b/spec/services/notifications/create_from_model_service_news_spec.rb
index b8d3fa9c904..574632496ec 100644
--- a/spec/services/notifications/create_from_model_service_news_spec.rb
+++ b/spec/services/notifications/create_from_model_service_news_spec.rb
@@ -66,10 +66,10 @@ describe Notifications::CreateFromModelService, 'news', with_settings: { journal
end
end
- context 'with the user having registered for involved notifications' do
+ context 'with the user having registered for assignee and responsible notifications' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
diff --git a/spec/services/notifications/create_from_model_service_wiki_spec.rb b/spec/services/notifications/create_from_model_service_wiki_spec.rb
index 7471a0bf2fb..639425c4105 100644
--- a/spec/services/notifications/create_from_model_service_wiki_spec.rb
+++ b/spec/services/notifications/create_from_model_service_wiki_spec.rb
@@ -72,10 +72,10 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
end
end
- context 'with the user having registered for involved notifications' do
+ context 'with the user having registered for assignee and responsible notifications' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
@@ -165,10 +165,10 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
end
end
- context 'with the user having registered for involved notifications' do
+ context 'with the user having registered for assignee and responsible notifications' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
diff --git a/spec/services/notifications/create_from_model_service_work_package_spec.rb b/spec/services/notifications/create_from_model_service_work_package_spec.rb
index 57d8d815100..212ba90dd08 100644
--- a/spec/services/notifications/create_from_model_service_work_package_spec.rb
+++ b/spec/services/notifications/create_from_model_service_work_package_spec.rb
@@ -103,7 +103,7 @@ describe Notifications::CreateFromModelService,
let(:user_property) { :assigned_to }
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
@@ -147,10 +147,10 @@ describe Notifications::CreateFromModelService,
it_behaves_like 'creates no notification'
end
- context 'when assignee has all in app notifications enabled but only involved for mail' do
+ context 'when assignee has all in app notifications enabled but only assignee for mail' do
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
@@ -194,7 +194,7 @@ describe Notifications::CreateFromModelService,
let(:user_property) { :responsible }
let(:recipient_notification_settings) do
[
- build(:notification_setting, **notification_settings_all_false.merge(involved: true))
+ build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
]
end
diff --git a/spec/services/notifications/mail_service_mentioned_integration_spec.rb b/spec/services/notifications/mail_service_mentioned_integration_spec.rb
index 0cba2953ca5..cbb9b1be65e 100644
--- a/spec/services/notifications/mail_service_mentioned_integration_spec.rb
+++ b/spec/services/notifications/mail_service_mentioned_integration_spec.rb
@@ -42,7 +42,8 @@ describe Notifications::MailService, 'Mentioned integration', type: :model do
notification_settings: [
build(:notification_setting,
mentioned: true,
- involved: true)
+ assignee: true,
+ responsible: true)
],
member_in_project: project,
member_through_role: role
@@ -62,7 +63,12 @@ describe Notifications::MailService, 'Mentioned integration', type: :model do
end
def expect_no_assigned_notification
- expect(Notification.where(recipient:, resource: work_package, reason: :involved))
+ expect(Notification.where(recipient:, resource: work_package, reason: :assignee))
+ .to be_empty
+ end
+
+ def expect_no_responsible_notification
+ expect(Notification.where(recipient:, resource: work_package, reason: :responsible))
.to be_empty
end
@@ -94,9 +100,10 @@ describe Notifications::MailService, 'Mentioned integration', type: :model do
.to have_received(:mentioned)
.once
- # No involved notification since the assignee is also mentioned which trumps
+ # No assignee and responsible notification since the assignee is also mentioned which trumps
# being assignee and a user will only get one notification for a journal.
expect_no_assigned_notification
+ expect_no_responsible_notification
expect_mentioned_notification
update_assignee!(assignee)
diff --git a/spec/services/notifications/mentioned_journals_shared.rb b/spec/services/notifications/mentioned_journals_shared.rb
index 86f19c18a7d..9d83de4cfe2 100644
--- a/spec/services/notifications/mentioned_journals_shared.rb
+++ b/spec/services/notifications/mentioned_journals_shared.rb
@@ -52,7 +52,8 @@ shared_context 'with a mentioned work package being updated again' do
notification_settings: [
build(:notification_setting,
mentioned: true,
- involved: true)
+ assignee: true,
+ responsible: true)
],
member_in_project: project,
member_through_role: role
diff --git a/spec/services/user_preferences/update_service_integration_spec.rb b/spec/services/user_preferences/update_service_integration_spec.rb
index de5c56847e3..4519acbd4f9 100644
--- a/spec/services/user_preferences/update_service_integration_spec.rb
+++ b/spec/services/user_preferences/update_service_integration_spec.rb
@@ -60,7 +60,8 @@ describe UserPreferences::UpdateService, 'integration', type: :model do
{
project_id: nil,
watched: false,
- involved: true,
+ assignee: true,
+ responsible: true,
work_package_commented: false,
work_package_created: true,
work_package_processed: true,
@@ -76,7 +77,8 @@ describe UserPreferences::UpdateService, 'integration', type: :model do
expect(default_ian.watched).to be true
expect(default_ian.mentioned).to be true
- expect(default_ian.involved).to be true
+ expect(default_ian.assignee).to be true
+ expect(default_ian.responsible).to be true
expect(default_ian.work_package_commented).to be true
expect(default_ian.work_package_created).to be true
expect(default_ian.work_package_processed).to be true
@@ -87,7 +89,8 @@ describe UserPreferences::UpdateService, 'integration', type: :model do
expect(subject.first.project_id).to be_nil
expect(subject.first.mentioned).to be false
expect(subject.first.watched).to be false
- expect(subject.first.involved).to be true
+ expect(default_ian.assignee).to be true
+ expect(default_ian.responsible).to be true
expect(subject.first.work_package_commented).to be false
expect(subject.first.work_package_created).to be true
expect(subject.first.work_package_processed).to be true
diff --git a/spec/support/pages/notifications/settings.rb b/spec/support/pages/notifications/settings.rb
index cb2d988e2d3..42ed49164dc 100644
--- a/spec/support/pages/notifications/settings.rb
+++ b/spec/support/pages/notifications/settings.rb
@@ -53,7 +53,8 @@ module Pages
def expect_global_represented(setting)
%i[
- involved
+ assignee
+ responsible
work_package_commented
work_package_created
work_package_processed
diff --git a/spec/workers/mails/shared/watcher_job.rb b/spec/workers/mails/shared/watcher_job.rb
index 3e025cdcd8a..d75809fa5ce 100644
--- a/spec/workers/mails/shared/watcher_job.rb
+++ b/spec/workers/mails/shared/watcher_job.rb
@@ -126,25 +126,25 @@ shared_examples "watcher job" do |action|
it_behaves_like 'notifies the watcher' do
let(:notification_settings) do
- [build_stubbed(:notification_setting, mentioned: false, involved: false, watched: true)]
+ [build_stubbed(:notification_setting, mentioned: false, assignee: false, responsible: false, watched: true)]
end
end
it_behaves_like 'notifies the watcher' do
let(:notification_settings) do
- [build_stubbed(:notification_setting, mentioned: false, involved: false, watched: true)]
+ [build_stubbed(:notification_setting, mentioned: false, assignee: false, responsible: false, watched: true)]
end
end
it_behaves_like 'does not notify the watcher' do
let(:notification_settings) do
- [build_stubbed(:notification_setting, mentioned: false, involved: true, watched: false)]
+ [build_stubbed(:notification_setting, mentioned: false, assignee: true, responsible: true, watched: false)]
end
end
it_behaves_like 'does not notify the watcher' do
let(:notification_settings) do
- [build_stubbed(:notification_setting, mentioned: true, involved: false, watched: false)]
+ [build_stubbed(:notification_setting, mentioned: true, assignee: false, responsible: false, watched: false)]
end
end