#53: rollback some changes, update ActivityFeedObserver according to Vladimir's comments

This commit is contained in:
Vokhmin Alexey V 2013-04-02 18:20:22 +04:00
parent 852015f0d5
commit 3a6e238209
4 changed files with 8 additions and 21 deletions

View File

@ -136,15 +136,17 @@ class ActivityFeedObserver < ActiveRecord::Observer
end
when 'BuildList'
if [BuildList::BUILD_PUBLISHED,
if ( record.status_changed? &&
[BuildList::BUILD_PUBLISHED,
BuildList::SUCCESS,
BuildList::BUILD_ERROR,
BuildList::PROJECT_VERSION_NOT_FOUND,
BuildList::FAILED_PUBLISH,
BuildList::TESTS_FAILED
].include? record.status or
(record.status == BuildList::BUILD_PENDING && record.bs_id_changed?)
].include?(record.status)
) or (record.status == BuildList::BUILD_PENDING && record.bs_id_changed?)
record.project.admins.each do |recipient|
user = record.publisher || record.user
ActivityFeed.create(
:user => recipient,
:kind => 'build_list_notification',
@ -156,10 +158,9 @@ class ActivityFeedObserver < ActiveRecord::Observer
:project_id => record.project_id,
:project_name => record.project.name,
:project_owner => record.project.owner.uname,
:user_name => record.user.name,
:user_email => record.user.email,
:user_id => record.user_id,
:publisher_fullname => record.publisher.try(:fullname)
:user_name => user.name,
:user_email => user.email,
:user_id => user.id
}
)
end

View File

@ -14,12 +14,6 @@
- ['success', nil]
- else ['failed', t("layout.build_lists.statuses.#{BuildList::HUMAN_STATUSES[status]}")]
= raw t("notifications.bodies.build_status.#{message}", :error => error)
- publisher_fullname ||= nil
- if status == BuildList::BUILD_PUBLISHED && publisher_fullname.present?
.both
%span
= t('activerecord.attributes.build_list.publisher')
= publisher_fullname
.both
%span.date= updated_at
.both

View File

@ -8,10 +8,6 @@
= @build_list.human_status
for arch
= "#{@build_list.arch.name}."
- if @build_list.build_published? && @build_list.publisher
%p
= t('activerecord.attributes.build_list.publisher')
= link_to @build_list.publisher.try(:fullname), user_url(@build_list.publisher)
%p
More detailed information you can get by link:
= link_to "task [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)

View File

@ -8,10 +8,6 @@
= @build_list.human_status
для архитектуры
= "#{@build_list.arch.name}."
- if @build_list.build_published? && @build_list.publisher
%p
= t('activerecord.attributes.build_list.publisher')
= link_to @build_list.publisher.try(:fullname), user_url(@build_list.publisher)
%p
Более подробную информацию можно получить по ссылке:
= link_to "задание [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)