diff --git a/config/initializers/extends/notifcation_extends.rb b/config/initializers/extends/notifcation_extends.rb new file mode 100644 index 000000000..6d0a7b9ba --- /dev/null +++ b/config/initializers/extends/notifcation_extends.rb @@ -0,0 +1,155 @@ +class NotificationExtends + NOTIFICATIONS_TYPES = { + designate_user_to_my_module_activity: { + code: 13, + recipients_module: :MyModuleDesignatedRecipients + }, + undesignate_user_from_my_module_activity: { + code: 14, + recipients_module: :MyModuleDesignatedRecipients + }, + my_module_due_date_reminder: { + recipients_module: :MyModuleDesignatedRecipients + }, + add_comment_to_module_activity: { + code: 35, + recipients_module: :MyModuleDesignatedRecipients + }, + edit_module_comment_activity: { + code: 36, + recipients_module: :MyModuleDesignatedRecipients + }, + delete_module_comment_activity: { + code: 37, + recipients_module: :MyModuleDesignatedRecipients + }, + add_comment_to_step_activity: { + code: 17, + recipients_module: :MyModuleDesignatedRecipients + }, + edit_step_comment_activity: { + code: 38, + recipients_module: :MyModuleDesignatedRecipients + }, + delete_step_comment_activity: { + code: 39, + recipients_module: :MyModuleDesignatedRecipients + }, + add_comment_to_result_activity: { + code: 24, + recipients_module: :MyModuleDesignatedRecipients + }, + edit_result_comment_activity: { + code: 40, + recipients_module: :MyModuleDesignatedRecipients + }, + delete_result_comment_activity: { + code: 41, + recipients_module: :MyModuleDesignatedRecipients + }, + assign_user_to_project_activity: { + code: 5, + recipients_module: :AssignedRecipients + }, + unassign_user_from_project_activity: { + code: 7, + recipients_module: :AssignedRecipients + }, + project_grant_access_to_all_team_members_activity: { + code: 242, + recipients_module: :AssignedGroupRecipients + }, + project_remove_access_from_all_team_members_activity: { + code: 243, + recipients_module: :AssignedGroupRecipients + }, + change_user_role_on_project_activity: { + code: 6, + recipients_module: :AssignedRecipients + }, + change_user_role_on_experiment_activity: { + code: 165, + recipients_module: :AssignedRecipients + }, + change_user_role_on_my_module_activity: { + code: 166, + recipients_module: :AssignedRecipients + }, + item_low_stock_reminder: { + recipients_module: :ItemCreatorRecipients + }, + item_date_reminder: { + recipients_module: :ItemCreatorRecipients + }, + smart_annotation_added: { + recipients_module: :AnnotatedRecipients + }, + invite_user_to_team_activity: { + code: 92, + recipients_module: :AssignedRecipients + }, + remove_user_from_team_activity: { + code: 93, + recipients_module: :AssignedRecipients + }, + change_users_role_on_team_activity: { + code: 94, + recipients_module: :AssignedRecipients + } + } + + NOTIFICATIONS_GROUPS = { + my_module: { + designation: %I[ + designate_user_to_my_module_activity + undesignate_user_from_my_module_activity + ], + modified: %I[], + due_date: %I[ + my_module_due_date_reminder + ], + comments: %I[ + add_comment_to_module_activity + edit_module_comment_activity + delete_module_comment_activity + add_comment_to_step_activity + edit_step_comment_activity + delete_step_comment_activity + add_comment_to_result_activity + edit_result_comment_activity + delete_result_comment_activity + ] + }, + project_experiment: { + access: %I[ + assign_user_to_project_activity + unassign_user_from_project_activity + project_grant_access_to_all_team_members_activity + project_remove_access_from_all_team_members_activity + ], + role_change: %I[ + change_user_role_on_project_activity + change_user_role_on_experiment_activity + change_user_role_on_my_module_activity + ] + }, + repository: { + stock: %I[ + item_low_stock_reminder + ], + date_reminder: %I[ + item_date_reminder + ] + }, + other: { + smart_annotation: %I[ + smart_annotation_added + ], + team_invitation: %I[ + invite_user_to_team_activity + remove_user_from_team_activity + change_users_role_on_team_activity + ] + } + } +end diff --git a/config/locales/notifications/en.yml b/config/locales/notifications/en.yml new file mode 100644 index 000000000..73396ba19 --- /dev/null +++ b/config/locales/notifications/en.yml @@ -0,0 +1,23 @@ +en: + notifications: + groups: + my_module: "Task" + project_experiment: "Project & Experiment" + repository: "Inventories & Items" + other: "Others" + sub_groups: + my_module_designation: "You are assigned to or unassigned from a task" + my_module_modified: "There is a change on assigned task" + my_module_due_date: "Due date & time on assigned task (24h before)" + my_module_comments: "A comment is added or changed on a task you are assigned to​" + project_experiment_access: "You are added or removed from the Project" + project_experiment_role_change: "Your role on Project, Experiment or Task is changed" + repository_stock: "A stock gets low (low stock reminder)" + repository_date_reminder: "Date reminder" + other_smart_annotation: "You are mentioned (tagged) in any place of Scinote" + other_team_invitation: "You are invited or removed from the team" + notification: + my_module_due_date_reminder_html: "Due date for %{my_module_name} is coming up" + item_low_stock_reminder_html: "Item %{repository_item_name} is running low" + item_date_reminder_html: "Date reminder for %{repository_item_name} is coming up in %{value} %{units}" +