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

add shared to notification reason

ulfertsd6215083d038
diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb
index d2c7c3221cc..63f96689012 100644
--- a/app/models/notification_setting.rb
+++ b/app/models/notification_setting.rb
@@ -3,6 +3,7 @@ class NotificationSetting < ApplicationRecord
ASSIGNEE = :assignee
RESPONSIBLE = :responsible
MENTIONED = :mentioned
+ SHARED = :shared
START_DATE = :start_date
DUE_DATE = :due_date
OVERDUE = :overdue
@@ -26,6 +27,7 @@ class NotificationSetting < ApplicationRecord
ASSIGNEE,
RESPONSIBLE,
MENTIONED,
+ SHARED,
WORK_PACKAGE_CREATED,
WORK_PACKAGE_COMMENTED,
WORK_PACKAGE_PROCESSED,
diff --git a/app/services/user_preferences/update_service.rb b/app/services/user_preferences/update_service.rb
index bf45ba206e5..2683b42e514 100644
--- a/app/services/user_preferences/update_service.rb
+++ b/app/services/user_preferences/update_service.rb
@@ -92,6 +92,7 @@ module UserPreferences
columns: %i[watched
assignee
responsible
+ shared
mentioned
start_date
due_date
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index d62c875c8bf..f7ae7144ca9 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -713,6 +713,7 @@ en:
description: 'Receive a notification every time someone mentions me anywhere'
assignee: 'Assignee'
responsible: 'Accountable'
+ shared: 'Shared'
watched: 'Watcher'
work_package_commented: 'All new comments'
work_package_created: 'New work packages'
diff --git a/db/migrate/20231024150429_add_shared_to_notification_settings.rb b/db/migrate/20231024150429_add_shared_to_notification_settings.rb
new file mode 100644
index 00000000000..5d936873f8e
--- /dev/null
+++ b/db/migrate/20231024150429_add_shared_to_notification_settings.rb
@@ -0,0 +1,5 @@
+class AddSharedToNotificationSettings < ActiveRecord::Migration[7.0]
+ def change
+ add_column :notification_settings, :shared, :boolean, default: false, null: false
+ end
+end
diff --git a/docs/api/apiv3/components/schemas/user_preferences_model.yml b/docs/api/apiv3/components/schemas/user_preferences_model.yml
index c1abfc6fbd3..0d59ee532a2 100644
--- a/docs/api/apiv3/components/schemas/user_preferences_model.yml
+++ b/docs/api/apiv3/components/schemas/user_preferences_model.yml
@@ -20,6 +20,7 @@ example:
- watched: false
involved: true
mentioned: false
+ shared: true
newsAdded: false,
newsCommented: false
documentAdded: false
diff --git a/docs/api/apiv3/paths/my_preferences.yml b/docs/api/apiv3/paths/my_preferences.yml
index 3db1e21dde1..2e11f669105 100644
--- a/docs/api/apiv3/paths/my_preferences.yml
+++ b/docs/api/apiv3/paths/my_preferences.yml
@@ -26,6 +26,7 @@ get:
watched: false
involved: true
mentioned: false
+ shared: true
newsAdded: false,
newsCommented: false
documentAdded: false
@@ -89,6 +90,7 @@ patch:
watched: false
involved: true
mentioned: false
+ shared: true
newsAdded: false,
newsCommented: false
documentAdded: false
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
index fe1242a46ab..d4563ad7d89 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
@@ -53,6 +53,18 @@
/>
</spot-selector-field>
+ <spot-selector-field
+ [label]="text.shared"
+ [control]="form.get('shared')"
+ >
+ <input
+ slot="input"
+ type="checkbox"
+ formControlName="shared"
+ data-qa-global-notification-type="shared"
+ />
+ </spot-selector-field>
+
<h5>{{ text.dateAlerts.title }}</h5>
<p>{{ text.dateAlerts.description }}</p>
<div *ngIf="!eeShowBanners">
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
index 010de25044e..80730c3db62 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
@@ -26,6 +26,7 @@ export const myNotificationsPageComponentSelector = 'op-notifications-page';
interface IToastSettingsValue {
assignee:boolean;
responsible:boolean;
+ shared:boolean;
workPackageCreated:boolean;
workPackageProcessed:boolean;
workPackageScheduled:boolean;
@@ -68,6 +69,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
public form = new UntypedFormGroup({
assignee: new UntypedFormControl(false),
responsible: new UntypedFormControl(false),
+ shared: new UntypedFormControl(false),
workPackageCreated: new UntypedFormControl(false),
workPackageProcessed: new UntypedFormControl(false),
workPackageScheduled: new UntypedFormControl(false),
@@ -118,6 +120,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
},
assignee: this.I18n.t('js.notifications.settings.reasons.assignee'),
responsible: this.I18n.t('js.notifications.settings.reasons.responsible'),
+ shared: this.I18n.t('js.notifications.settings.reasons.shared'),
startDate: this.I18n.t('js.work_packages.properties.startDate'),
dueDate: this.I18n.t('js.work_packages.properties.dueDate'),
overdue: this.I18n.t('js.notifications.settings.global.overdue'),
@@ -178,6 +181,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
this.form.get('assignee')?.setValue(settings.assignee);
this.form.get('responsible')?.setValue(settings.responsible);
+ this.form.get('shared')?.setValue(settings.shared);
this.form.get('workPackageCreated')?.setValue(settings.workPackageCreated);
this.form.get('workPackageProcessed')?.setValue(settings.workPackageProcessed);
this.form.get('workPackageScheduled')?.setValue(settings.workPackageScheduled);
@@ -211,6 +215,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
project: new UntypedFormControl(setting._links.project),
assignee: new UntypedFormControl(setting.assignee),
responsible: new UntypedFormControl(setting.responsible),
+ shared: new UntypedFormControl(setting.shared),
workPackageCreated: new UntypedFormControl(setting.workPackageCreated),
workPackageProcessed: new UntypedFormControl(setting.workPackageProcessed),
workPackageScheduled: new UntypedFormControl(setting.workPackageScheduled),
@@ -239,6 +244,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
mentioned: true,
assignee: notificationSettings.assignee,
responsible: notificationSettings.responsible,
+ shared: notificationSettings.shared,
workPackageCreated: notificationSettings.workPackageCreated,
workPackageProcessed: notificationSettings.workPackageProcessed,
workPackageScheduled: notificationSettings.workPackageScheduled,
@@ -255,6 +261,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
mentioned: true,
assignee: settings.assignee,
responsible: settings.responsible,
+ shared: settings.shared,
workPackageCreated: settings.workPackageCreated,
workPackageProcessed: settings.workPackageProcessed,
workPackageScheduled: settings.workPackageScheduled,
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 b7459728f55..739bdd7b0e3 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
@@ -72,6 +72,21 @@
</td>
</ng-container>
</tr>
+ <tr>
+ <th class="op-table--cell op-table--cell_soft-heading">
+ {{ text.shared }}
+ </th>
+ <ng-container *ngFor="let item of settings.controls">
+ <td class="op-table--cell" [formGroup]="item">
+ <input
+ type="checkbox"
+ formControlName="shared"
+ data-qa-project-notification-type="shared"
+ [attr.data-qa-project]="item.controls.project.value.title"
+ />
+ </td>
+ </ng-container>
+ </tr>
<tr *ngIf="!eeShowBanners">
<th class="op-table--cell op-table--cell_soft-heading">
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 bd46f864a65..476cbd08cfc 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
@@ -64,6 +64,7 @@ export class NotificationSettingsTableComponent implements OnInit {
},
assignee: this.I18n.t('js.notifications.settings.reasons.assignee'),
responsible: this.I18n.t('js.notifications.settings.reasons.responsible'),
+ shared: this.I18n.t('js.notifications.settings.reasons.shared'),
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'),
@@ -95,6 +96,7 @@ export class NotificationSettingsTableComponent implements OnInit {
project: new UntypedFormControl(project),
assignee: new UntypedFormControl(false),
responsible: new UntypedFormControl(false),
+ shared: new UntypedFormControl(false),
workPackageCreated: new UntypedFormControl(false),
workPackageProcessed: new UntypedFormControl(false),
workPackageScheduled: new UntypedFormControl(false),
diff --git a/frontend/src/app/features/user-preferences/state/notification-setting.model.ts b/frontend/src/app/features/user-preferences/state/notification-setting.model.ts
index accbc9a202d..0d994f8adbe 100644
--- a/frontend/src/app/features/user-preferences/state/notification-setting.model.ts
+++ b/frontend/src/app/features/user-preferences/state/notification-setting.model.ts
@@ -5,6 +5,7 @@ export interface INotificationSetting {
watched:boolean;
assignee:boolean;
responsible:boolean;
+ shared:boolean;
mentioned:boolean;
workPackageCommented:boolean;
workPackageCreated:boolean;
@@ -34,6 +35,7 @@ export function buildNotificationSetting(project:null|HalSourceLink, params:Part
},
assignee: true,
responsible: true,
+ shared: true,
mentioned: true,
watched: true,
workPackageCommented: true,
diff --git a/spec/features/users/notifications/shared_examples.rb b/spec/features/users/notifications/shared_examples.rb
index 3d5ba107d24..01e35b0bd36 100644
--- a/spec/features/users/notifications/shared_examples.rb
+++ b/spec/features/users/notifications/shared_examples.rb
@@ -17,6 +17,7 @@ RSpec.shared_examples 'notification settings workflow' do
# Set settings for global email
settings_page.configure_global assignee: true,
responsible: true,
+ shared: true,
work_package_commented: true,
work_package_created: true,
work_package_processed: true,
@@ -32,6 +33,7 @@ RSpec.shared_examples 'notification settings workflow' do
settings_page.configure_project project:,
assignee: true,
responsible: true,
+ shared: true,
work_package_commented: false,
work_package_created: false,
work_package_processed: false,
@@ -56,6 +58,7 @@ RSpec.shared_examples 'notification settings workflow' do
expect(global_settings.responsible).to be_truthy
expect(global_settings.mentioned).to be_truthy
expect(global_settings.watched).to be_truthy
+ expect(global_settings.shared).to be_truthy
expect(global_settings.work_package_commented).to be_truthy
expect(global_settings.work_package_created).to be_truthy
expect(global_settings.work_package_processed).to be_truthy
@@ -70,6 +73,7 @@ RSpec.shared_examples 'notification settings workflow' do
expect(project_settings.responsible).to be_truthy
expect(project_settings.mentioned).to be_truthy
expect(project_settings.watched).to be_truthy
+ expect(project_settings.shared).to be_truthy
expect(project_settings.work_package_commented).to be_falsey
expect(project_settings.work_package_created).to be_falsey
expect(project_settings.work_package_processed).to be_falsey
diff --git a/spec/features/users/notifications/user_notifications_settings_spec.rb b/spec/features/users/notifications/user_notifications_settings_spec.rb
index 4cf16184437..be864bb720c 100644
--- a/spec/features/users/notifications/user_notifications_settings_spec.rb
+++ b/spec/features/users/notifications/user_notifications_settings_spec.rb
@@ -1,9 +1,9 @@
require 'rails_helper'
-require_relative './shared_examples'
+require_relative 'shared_examples'
RSpec.describe "user notifications settings",
- js: true,
- with_cuprite: true do
+ :js,
+ :with_cuprite do
shared_let(:user) { create(:user) }
let(:settings_page) { Pages::Notifications::Settings.new(user) }