#349: send notifications to platform members
This commit is contained in:
parent
430e01f649
commit
672aa331be
|
@ -69,6 +69,21 @@ class UserMailer < ActionMailer::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def metadata_regeneration_notification(platform, user)
|
||||||
|
set_locale user
|
||||||
|
@user, @platform = user, platform
|
||||||
|
|
||||||
|
subject = "[#{platform.name}] "
|
||||||
|
subject << I18n.t("notifications.subjects.metadata_regeneration", status: I18n.t("layout.regeneration_statuses.last_regenerated_statuses.#{platform.human_regeneration_status}"))
|
||||||
|
mail(
|
||||||
|
to: email_with_name(user, user.email),
|
||||||
|
subject: subject,
|
||||||
|
from: email_with_name(platform.owner)
|
||||||
|
) do |format|
|
||||||
|
format.html
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def invite_approve_notification(register_request)
|
def invite_approve_notification(register_request)
|
||||||
set_locale register_request
|
set_locale register_request
|
||||||
@register_request = register_request
|
@register_request = register_request
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Group < Avatar
|
||||||
attr_accessible :uname, :description
|
attr_accessible :uname, :description
|
||||||
attr_readonly :uname
|
attr_readonly :uname
|
||||||
|
|
||||||
delegate :email, to: :owner
|
delegate :email, :user_appeal, to: :owner
|
||||||
|
|
||||||
after_create :add_owner_to_members
|
after_create :add_owner_to_members
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,9 @@ class Platform < ActiveRecord::Base
|
||||||
include Modules::Models::Owner
|
include Modules::Models::Owner
|
||||||
|
|
||||||
state_machine :status, initial: :ready do
|
state_machine :status, initial: :ready do
|
||||||
|
|
||||||
|
after_transition on: :ready, do: :notify_users
|
||||||
|
|
||||||
event :ready do
|
event :ready do
|
||||||
transition regenerating: :ready
|
transition regenerating: :ready
|
||||||
end
|
end
|
||||||
|
@ -265,4 +268,10 @@ class Platform < ActiveRecord::Base
|
||||||
repositories.update_all(publish_without_qa: false)
|
repositories.update_all(publish_without_qa: false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def notify_users
|
||||||
|
users = members.includes(:notifier).select{ |u| u.notifier.can_notify? }
|
||||||
|
users.each{ |u| UserMailer.metadata_regeneration_notification(self, u).deliver }
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
%p
|
||||||
|
Metadata regeneration for platform
|
||||||
|
= link_to @platform.name, platform_url(@platform)
|
||||||
|
completed with status
|
||||||
|
%b
|
||||||
|
= t("layout.regeneration_statuses.last_regenerated_statuses.#{@platform.human_regeneration_status}")
|
||||||
|
%p
|
||||||
|
More detailed information you can get by link:
|
||||||
|
= link_to t('layout.platforms.metadata'), edit_platform_url(@platform)
|
||||||
|
|
||||||
|
= render 'footer'
|
|
@ -0,0 +1,11 @@
|
||||||
|
%p
|
||||||
|
Регенерация метаданных для платформы
|
||||||
|
= link_to @platform.name, platform_url(@platform)
|
||||||
|
завершена со статусом
|
||||||
|
%b
|
||||||
|
= t("layout.regeneration_statuses.last_regenerated_statuses.#{@platform.human_regeneration_status}")
|
||||||
|
%p
|
||||||
|
Более подробную информацию можно получить по ссылке:
|
||||||
|
= link_to t('layout.platforms.metadata'), edit_platform_url(@platform)
|
||||||
|
|
||||||
|
= render 'footer'
|
|
@ -20,6 +20,7 @@ en:
|
||||||
issue_assign_notification: New task assigned
|
issue_assign_notification: New task assigned
|
||||||
invite_approve_notification: Invitation to ABF
|
invite_approve_notification: Invitation to ABF
|
||||||
for_arch: for arch %{arch}.
|
for_arch: for arch %{arch}.
|
||||||
|
metadata_regeneration: Metadata regeneration «%{status}»
|
||||||
|
|
||||||
bodies:
|
bodies:
|
||||||
view_it_on: View it on
|
view_it_on: View it on
|
||||||
|
|
|
@ -20,6 +20,7 @@ ru:
|
||||||
issue_assign_notification: Вам назначили задачу
|
issue_assign_notification: Вам назначили задачу
|
||||||
invite_approve_notification: Приглашение в ABF
|
invite_approve_notification: Приглашение в ABF
|
||||||
for_arch: для архитектуры %{arch}.
|
for_arch: для архитектуры %{arch}.
|
||||||
|
metadata_regeneration: Регенерация метаданных «%{status}»
|
||||||
|
|
||||||
bodies:
|
bodies:
|
||||||
view_it_on: Смотрите это на
|
view_it_on: Смотрите это на
|
||||||
|
|
Loading…
Reference in New Issue