2014-03-11 07:39:25 +00:00
|
|
|
module Feed::BuildList
|
2013-06-27 15:37:41 +01:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
after_update :build_list_notifications
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def build_list_notifications
|
|
|
|
if mass_build.blank? && ( # Do not show mass build activity in activity feeds
|
|
|
|
status_changed? && [
|
2013-07-01 13:30:54 +01:00
|
|
|
BuildList::BUILD_PENDING,
|
2013-06-27 16:00:56 +01:00
|
|
|
BuildList::BUILD_PUBLISHED,
|
|
|
|
BuildList::SUCCESS,
|
|
|
|
BuildList::BUILD_ERROR,
|
|
|
|
BuildList::FAILED_PUBLISH,
|
|
|
|
BuildList::TESTS_FAILED
|
2013-07-01 13:30:54 +01:00
|
|
|
].include?(status)
|
2013-06-27 15:37:41 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
updater = publisher || user
|
2013-08-28 16:13:11 +01:00
|
|
|
(project.admins | [publisher].compact).each do |recipient|
|
2013-06-27 15:37:41 +01:00
|
|
|
ActivityFeed.create(
|
2014-01-21 04:51:49 +00:00
|
|
|
user: recipient,
|
|
|
|
kind: 'build_list_notification',
|
|
|
|
data: {
|
|
|
|
build_list_id: id,
|
|
|
|
status: status,
|
|
|
|
updated_at: updated_at,
|
|
|
|
project_id: project_id,
|
|
|
|
project_name: project.name,
|
|
|
|
project_owner: project.owner.uname,
|
|
|
|
user_name: updater.name,
|
|
|
|
user_email: updater.email,
|
|
|
|
user_id: updater.id
|
2013-06-27 15:37:41 +01:00
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|