This commit is contained in:
Vokhmin Alexey V 2015-05-22 23:31:43 +03:00
parent 95d5f4a384
commit ae572b96d8
3 changed files with 33 additions and 37 deletions

View File

@ -37,7 +37,7 @@ module BuildListObserver
end
build_count = statistic.build_count.to_i
new_av_time = ( statistic.average_build_time * build_count + duration.to_i ) / ( build_count + 1 )
statistic.update_attributes({average_build_time: new_av_time, build_count: build_count + 1}, without_protection: true)
statistic.update_attributes(average_build_time: new_av_time, build_count: build_count + 1)
end
end
end

View File

@ -17,22 +17,20 @@ module Feed::Comment
if can_notify_on_new_comment?(subscribe)
UserMailer.new_comment_notification(self, subscribe.user_id).deliver unless own_comment?(subscribe.user)
ActivityFeed.create(
{
user_id: subscribe.user_id,
kind: 'new_comment_notification',
project_owner: project.owner_uname,
project_name: project.name,
creator_id: user_id,
data: {
creator_name: user.name,
creator_email: user.email,
comment_body: body.truncate(100, omission: '…'),
issue_title: commentable.title,
issue_serial_id: commentable.serial_id,
project_id: commentable.project.id,
comment_id: id
}
}, without_protection: true
user_id: subscribe.user_id,
kind: 'new_comment_notification',
project_owner: project.owner_uname,
project_name: project.name,
creator_id: user_id,
data: {
creator_name: user.name,
creator_email: user.email,
comment_body: body.truncate(100, omission: '…'),
issue_title: commentable.title,
issue_serial_id: commentable.serial_id,
project_id: commentable.project.id,
comment_id: id
}
)
end
end
@ -46,23 +44,21 @@ module Feed::Comment
UserMailer.new_comment_notification(self, subscribe.user_id).deliver
end
ActivityFeed.create(
{
user_id: subscribe.user_id,
kind: 'new_comment_commit_notification',
project_owner: project.owner_uname,
project_name: project.name,
creator_id: user_id,
data: {
creator_name: user.name,
creator_email: user.email,
user_id: subscribe.user_id,
kind: 'new_comment_commit_notification',
project_owner: project.owner_uname,
project_name: project.name,
creator_id: user_id,
data: {
creator_name: user.name,
creator_email: user.email,
comment_body: body.truncate(100, omission: '…'),
commit_message: commentable.message.truncate(70, omission: '…'),
commit_id: commentable.id,
project_id: project.id,
comment_id: id
}
}, without_protection: true
comment_body: body.truncate(100, omission: '…'),
commit_message: commentable.message.truncate(70, omission: '…'),
commit_id: commentable.id,
project_id: project.id,
comment_id: id
}
)
end
end

View File

@ -191,8 +191,8 @@ describe BuildList do
auto_publish_status: BuildList::AUTO_PUBLISH_STATUS_DEFAULT,
project: project
)
bl.update_attributes({commit_hash: bl.project.repo.commits('master').last.id,
status: BuildList::BUILD_PUBLISH}, without_protection: true)
bl.update_attributes(commit_hash: bl.project.repo.commits('master').last.id,
status: BuildList::BUILD_PUBLISH)
bl.published
expect(subject.count).to eq 1
end
@ -287,7 +287,7 @@ describe BuildList do
let(:build_list) { FactoryGirl.create(:build_list) }
before do
build_list.update_attributes({ status: BuildList::SUCCESS }, without_protection: true)
build_list.update_attributes(status: BuildList::SUCCESS)
allow(build_list).to receive(:valid_branch_for_publish?).and_return(true)
end
@ -315,7 +315,7 @@ describe BuildList do
let(:build_list) { FactoryGirl.create(:build_list) }
before do
build_list.update_attributes({ status: BuildList::SUCCESS }, without_protection: true)
build_list.update_attributes(status: BuildList::SUCCESS)
end
it 'returns true for eligible build' do