Merge pull request #304 from warpc/265-activity_feed_messages

[Refs #265] activity feed upgrade:
* added build waiting message;
* shoter(only 10 symbols) commit hash in message;
* remove existing hook when install from task.
This commit is contained in:
Vladimir Sharshov 2012-03-19 03:06:12 -07:00
commit 7e830c2e39
7 changed files with 9 additions and 4 deletions

View File

@ -33,7 +33,7 @@ module CommitHelper
end
def shortest_hash_id(id)
id[0..8]
id[0..9]
end
def short_commit_message(message)

View File

@ -131,7 +131,8 @@ class ActivityFeedObserver < ActiveRecord::Observer
when 'BuildList'
if [BuildList::BUILD_PUBLISHED, BuildServer::SUCCESS, BuildServer::BUILD_ERROR, BuildServer::PLATFORM_NOT_FOUND,
BuildServer::PROJECT_NOT_FOUND, BuildServer::PROJECT_VERSION_NOT_FOUND, BuildList::FAILED_PUBLISH].include? record.status
BuildServer::PROJECT_NOT_FOUND, BuildServer::PROJECT_VERSION_NOT_FOUND, BuildList::FAILED_PUBLISH].include? record.status or
(record.status == BuildList::BUILD_PENDING && record.bs_id_changed?)
record.project.owner_and_admin_ids.each do |recipient|
ActivityFeed.create(
:user => User.find(recipient),

View File

@ -6,6 +6,8 @@
= raw t('notifications.bodies.build_task', :task_num => task_num, :task_link => build_list_path(build_list_id))
= raw t('notifications.bodies.project', :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
- message, error = case status
- when BuildList::BUILD_PENDING
- ['pending', nil]
- when BuildList::BUILD_PUBLISHED
- ['published', nil]
- when BuildServer::SUCCESS

View File

@ -11,6 +11,6 @@
.both
%span.subject
- last_commits.each do |commit|
= link_to commit[0], commit_path(project_id, commit[0])
= link_to shortest_hash_id(commit[0]), commit_path(project_id, commit[0])
= commit[1]
%br

View File

@ -41,3 +41,4 @@ en:
published: published successfully
success: complete successfully
failed: complete with error "%{error}"
pending: build waiting

View File

@ -43,3 +43,4 @@ ru:
published: успешно опубликовано
success: успешно собрано
failed: завершилось с ошибкой "%{error}"
pending: ожидает сборки

View File

@ -18,7 +18,7 @@ namespace :hook do
projects = ENV['project_id'] ? Project.where(:id => eval(ENV['project_id'])) : Project
projects.where('created_at >= ?', Time.now.ago(ENV['period'] ? eval(ENV['period']) : 100.years)).each do |project|
hook_file = File.join(project.path, 'hooks', 'post-receive')
FileUtils.cp(hook, hook_file)
FileUtils.copy_entry(hook, hook_file, false, false, true)
count = count + 1
end
say "Writing to #{count.to_s} repo(s)"