Merge pull request #6759 from ivanscinote/SCI-9782-ik

Create RepositoryItemRecipients for Low Stock and Date/Date&Time notifications [SCI-9782]
This commit is contained in:
Martin Artnik 2023-12-06 10:40:34 +01:00 committed by GitHub
commit 94e8a8d89f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 13 deletions

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
class Recipients::RepositoryItemRecipients
def initialize(params)
@repository_row_id = params[:repository_row_id]
end
def recipients
repository_row = RepositoryRow.find(@repository_row_id)
repository_row.repository.team.users
end
end

View file

@ -1,11 +0,0 @@
# frozen_string_literal: true
class Recipients::RepositoryRowCreator
def initialize(params)
@params = params
end
def recipients
[RepositoryRow.find(@params[:repository_row_id]).created_by]
end
end

View file

@ -78,10 +78,10 @@ class NotificationExtends
recipients_module: :AssignedRecipients
},
item_low_stock_reminder: {
recipients_module: :RepositoryRowCreator
recipients_module: :RepositoryItemRecipients
},
item_date_reminder: {
recipients_module: :RepositoryRowCreator
recipients_module: :RepositoryItemRecipients
},
smart_annotation_added: {
recipients_module: :DirectRecipient