[#43675] fig regarding comments

pull/11339/head
Dmitrii 2 years ago
parent 0c85cc4287
commit 4534007a3b
  1. 3
      config/locales/js-en.yml
  2. 6
      db/migrate/20220922200908_split_involved_notification_setting.rb
  3. 10
      frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
  4. 28
      modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb
  5. 14
      spec/services/notifications/create_from_model_service_comment_spec.rb
  6. 28
      spec/services/notifications/create_from_model_service_message_spec.rb
  7. 14
      spec/services/notifications/create_from_model_service_news_spec.rb
  8. 28
      spec/services/notifications/create_from_model_service_wiki_spec.rb
  9. 6
      spec/services/notifications/create_from_model_service_work_package_spec.rb

@ -629,9 +629,6 @@ en:
mentioned:
title: 'I am @mentioned'
description: 'Receive a notification every time someone mentions me anywhere'
involved:
title: 'Assigned to me or accountable'
description: 'Receive notifications for all activities on work packages for which I am assignee or accountable'
assignee: 'Assignee'
responsible: 'Accountable'
watched: 'Updates on watched items'

@ -1,4 +1,4 @@
class AddAssignee < ActiveRecord::Migration[7.0]
class SplitInvolvedNotificationSetting < ActiveRecord::Migration[7.0]
def change
change_table :notification_settings, bulk: true do |t|
t.column :assignee, :boolean, default: false, null: false
@ -8,13 +8,13 @@ class AddAssignee < ActiveRecord::Migration[7.0]
reversible do |change|
change.up do
NotificationSetting.where(involved: true).update_all(assignee: true, responsible: true)
remove_column :notification_settings, :involved, :boolean
end
change.down do
add_column :notification_settings, :involved, :boolean
NotificationSetting.where(assignee: true).or(NotificationSetting.where(responsible: true)).update_all(involved: true)
end
end
remove_column :notification_settings, :involved, :boolean
end
end

@ -17,9 +17,9 @@
slot="input"
/>
<p slot="description">{{ text.mentioned.description }}</p>
</op-checkbox-field>
</spot-selector-field>
<op-checkbox-field
<spot-selector-field
[label]="text.assignee"
[control]="form.get('assignee')"
>
@ -29,9 +29,9 @@
formControlName="assignee"
data-qa-global-notification-type="assignee"
/>
</op-checkbox-field>
</spot-selector-field>
<op-checkbox-field
<spot-selector-field
[label]="text.responsible"
[control]="form.get('responsible')"
>
@ -41,7 +41,7 @@
formControlName="responsible"
data-qa-global-notification-type="responsible"
/>
</op-checkbox-field>
</spot-selector-field>
<h5>{{ text.alsoNotifyFor.title }}</h5>
<p>{{ text.alsoNotifyFor.description }}</p>

@ -68,10 +68,20 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
end
end
context 'with the user having registered for assignee and responsible notifications' do
context 'with the user having registered for assignee notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
it_behaves_like 'creates no notification'
end
context 'with the user having registered for responsible notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end
@ -116,10 +126,20 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
end
end
context 'with the user having registered for assignee and responsible notifications' do
context 'with the user having registered for assignee notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
it_behaves_like 'creates no notification'
end
context 'with the user having registered for responsible notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end

@ -73,10 +73,20 @@ describe Notifications::CreateFromModelService, 'comment', with_settings: { jour
end
end
context 'with the user having registered for assignee and responsible notifications' do
context 'with the user having registered for assignee notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
it_behaves_like 'creates no notification'
end
context 'with the user having registered for responsible notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end

@ -74,10 +74,20 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
end
end
context 'with the user having registered for assignee and responsible notifications' do
context 'with the user having registered for assignee notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
it_behaves_like 'creates no notification'
end
context 'with the user having registered for responsible notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end
@ -206,10 +216,20 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
end
end
context 'with the user having registered for assignee and responsible notifications' do
context 'with the user having registered for assignee notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
it_behaves_like 'creates no notification'
end
context 'with the user having registered for responsible notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end

@ -66,10 +66,20 @@ describe Notifications::CreateFromModelService, 'news', with_settings: { journal
end
end
context 'with the user having registered for assignee and responsible notifications' do
context 'with the user having registered for assignee notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
it_behaves_like 'creates no notification'
end
context 'with the user having registered for responsible notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end

@ -72,10 +72,20 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
end
end
context 'with the user having registered for assignee and responsible notifications' do
context 'with the user having registered for assignee notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
it_behaves_like 'creates no notification'
end
context 'with the user having registered for responsible notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end
@ -165,10 +175,20 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
end
end
context 'with the user having registered for assignee and responsible notifications' do
context 'with the user having registered for assignee notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
it_behaves_like 'creates no notification'
end
context 'with the user having registered for responsible notifications' do
let(:recipient_notification_settings) do
[
build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end

@ -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(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(assignee: true))
]
end
@ -150,7 +150,7 @@ describe Notifications::CreateFromModelService,
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(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(assignee: 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(assignee: true, responsible: true))
build(:notification_setting, **notification_settings_all_false.merge(responsible: true))
]
end

Loading…
Cancel
Save