mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
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:
commit
94e8a8d89f
3 changed files with 14 additions and 13 deletions
12
app/notifications/recipients/repository_item_recipients.rb
Normal file
12
app/notifications/recipients/repository_item_recipients.rb
Normal 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
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue