#946 make avatar url

This commit is contained in:
Alexander Machehin 2013-02-22 20:43:51 +06:00
parent d0708f484b
commit 51856df0d1
6 changed files with 22 additions and 23 deletions

View File

@ -18,7 +18,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
ActivityFeed.create(
:user => recipient,
:kind => 'new_issue_notification',
:data => {:user_name => record.user.name, :user_email => record.user.email, :user_uname => record.user.uname,:issue_serial_id => record.serial_id,
:data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id,:issue_serial_id => record.serial_id,
:issue_title => record.title, :project_id => record.project.id, :project_name => record.project.name, :project_owner => record.project.owner.uname}
)
end
@ -28,7 +28,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
ActivityFeed.create(
:user => record.user,
:kind => 'issue_assign_notification',
:data => {:user_name => record.user.name, :user_email => record.user.email, :issue_serial_id => record.serial_id,
:data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :issue_serial_id => record.serial_id,
:project_id => record.project.id, :issue_title => record.title, :project_name => record.project.name, :project_owner => record.project.owner.uname}
)
end
@ -42,7 +42,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
ActivityFeed.create(
:user => subscribe.user,
:kind => 'new_comment_notification',
:data => {:user_name => record.user.name, :user_email => record.user.email, :user_uname => record.user.uname, :comment_body => record.body,
:data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body,
:issue_title => record.commentable.title, :issue_serial_id => record.commentable.serial_id, :project_id => record.commentable.project.id,
:comment_id => record.id, :project_name => record.project.name, :project_owner => record.project.owner.uname}
)
@ -61,7 +61,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
ActivityFeed.create(
:user => subscribe.user,
:kind => 'new_comment_commit_notification',
:data => {:user_name => record.user.name, :user_email => record.user.email, :user_uname => record.user.uname, :comment_body => record.body,
:data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body,
:commit_message => record.commentable.message, :commit_id => record.commentable.id,
:project_id => record.project.id, :comment_id => record.id, :project_name => record.project.name, :project_owner => record.project.owner.uname}
)
@ -90,7 +90,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
options = {:project_id => record.project.id, :project_name => record.project.name, :last_commits => last_commits, :branch_name => branch_name,
:change_type => change_type, :user_email => record.project.repo.log(branch_name, nil).first.author.email,
:project_owner => record.project.owner.uname}
options.merge!({:user_name => first_commiter.name, :user_uname => first_commiter.uname}) if first_commiter
options.merge!({:user_id => first_commiter.id, :user_name => first_commiter.name}) if first_commiter
end
record.project.admins.each do |recipient|
@ -109,7 +109,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
ActivityFeed.create!(
:user => recipient,
:kind => 'wiki_new_commit_notification',
:data => {:user_name => actor.name, :user_email => actor.email, :project_id => project.id, :user_uname => actor.uname,
:data => {:user_id => actor.id, :user_name => actor.name, :user_email => actor.email, :project_id => project.id,
:project_name => project.name, :commit_sha => record[:commit_sha], :project_owner => project.owner.uname}
)
end
@ -144,7 +144,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
:kind => 'build_list_notification',
:data => {:task_num => record.bs_id, :build_list_id => record.id, :status => record.status, :updated_at => record.updated_at,
: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_uname => record.user.uname}
:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id}
)
end
end

View File

@ -1,10 +1,9 @@
-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email)
.top
- if defined?(user_email)
.image
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
.image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted?
.text
%span
-user_link = defined?(user_name) ? (defined?(user_uname) ? link_to(user_name, user_path(user_uname)) : user_name) : user_email
-user_link = defined?(user_email) ? (user ? link_to(user_name, user_path(user)) : user_name) : user_email
= raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => user_link})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both

View File

@ -1,9 +1,9 @@
-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email)
.top
.image
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
.image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted?
.text
%span
= raw t("notifications.bodies.new_comment_notification.title", :user_link => defined?(user_uname) ? link_to(user_name, user_path(user_uname)) : user_name )
= raw t("notifications.bodies.new_comment_notification.title", :user_link => user.persisted? ? link_to(user_name, user_path(user)) : user_name )
= raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_owner, project_name, commit_id) + "#comment#{comment_id}")})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both

View File

@ -1,9 +1,9 @@
-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email)
.top
.image
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
.image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted?
.text
%span
= raw t("notifications.bodies.new_comment_notification.title", {:user_link => defined?(user_uname) ? link_to(user_name, user_path(user_uname)) : user_name})
= raw t("notifications.bodies.new_comment_notification.title", {:user_link => user.persisted? ? link_to(user_name, user_path(user)) : user_name})
= raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id) + "#comment#{comment_id}")})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both

View File

@ -1,9 +1,9 @@
-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email)
.top
.image
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
.image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted?
.text
%span
= raw t("notifications.bodies.new_issue_notification", { :user_link => defined?(user_uname) ? link_to(user_name, user_path(user_uname)) : user_name, :issue_link => project_issue_path(project_owner, project_name, issue_serial_id)})
= raw t("notifications.bodies.new_issue_notification", { :user_link => user.persisted? ? link_to(user_name, user_path(user)) : user_name, :issue_link => project_issue_path(project_owner, project_name, issue_serial_id)})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both
%span.date= activity_feed.created_at

View File

@ -1,9 +1,9 @@
-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email)
.top
.image
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
.image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted?
.text
%span
-user_link = defined?(user_uname) ? link_to(user_name, user_path(user_uname)) : user_name
-user_link = user.persisted? ? link_to(user_name, user_path(user)) : user_name
= raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_link, :history_link => link_to("wiki", history_project_wiki_index_path(project_owner, project_name))})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both