Commit 3abd977822247581465ff6d6df52d2c08e8da508

Authored by gitlabhq
1 parent 020e1a8e

fixed error with ascii error for dashboard

app/models/issue.rb
@@ -10,6 +10,11 @@ class Issue < ActiveRecord::Base @@ -10,6 +10,11 @@ class Issue < ActiveRecord::Base
10 validates_presence_of :assignee_id 10 validates_presence_of :assignee_id
11 validates_presence_of :author_id 11 validates_presence_of :author_id
12 12
  13 + delegate :name,
  14 + :email,
  15 + :to => :author,
  16 + :prefix => true
  17 +
13 validates :title, 18 validates :title,
14 :presence => true, 19 :presence => true,
15 :length => { :within => 0..255 } 20 :length => { :within => 0..255 }
app/models/note.rb
@@ -7,6 +7,11 @@ class Note < ActiveRecord::Base @@ -7,6 +7,11 @@ class Note < ActiveRecord::Base
7 belongs_to :author, 7 belongs_to :author,
8 :class_name => "User" 8 :class_name => "User"
9 9
  10 + delegate :name,
  11 + :email,
  12 + :to => :author,
  13 + :prefix => true
  14 +
10 attr_protected :author, :author_id 15 attr_protected :author, :author_id
11 16
12 validates_presence_of :project 17 validates_presence_of :project
app/views/commits/_commits.html.haml
@@ -11,15 +11,15 @@ @@ -11,15 +11,15 @@
11 %i 11 %i
12 %data.commit-browse{ :onclick => "location.href='#{tree_project_path(@project, :commit_id => commit.id)}';return false;"} 12 %data.commit-browse{ :onclick => "location.href='#{tree_project_path(@project, :commit_id => commit.id)}';return false;"}
13 Browse Code 13 Browse Code
14 - - if commit.author.email  
15 - = image_tag gravatar_icon(commit.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" 14 + - if commit.author_email
  15 + = image_tag gravatar_icon(commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
16 - else 16 - else
17 = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" 17 = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
18 %span.commit-title 18 %span.commit-title
19 %strong 19 %strong
20 = truncate(commit.safe_message, :length => 60) 20 = truncate(commit.safe_message, :length => 60)
21 %span.commit-author 21 %span.commit-author
22 - %strong= commit.author 22 + %strong= commit.author_name
23 = time_ago_in_words(commit.committed_date) 23 = time_ago_in_words(commit.committed_date)
24 ago 24 ago
25 = more_commits_link if @commits.size > 99 25 = more_commits_link if @commits.size > 99
app/views/commits/show.html.haml
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 %td= @commit.id 7 %td= @commit.id
8 %tr 8 %tr
9 %td Author 9 %td Author
10 - %td= @commit.author 10 + %td= @commit.author_name
11 %tr 11 %tr
12 %td Commiter 12 %td Commiter
13 %td= @commit.committer 13 %td= @commit.committer
app/views/dashboard/index.html.haml
@@ -25,11 +25,11 @@ @@ -25,11 +25,11 @@
25 .data 25 .data
26 - project.updates.each do |update| 26 - project.updates.each do |update|
27 %a.project-update{:href => dashboard_feed_path(project, update)} 27 %a.project-update{:href => dashboard_feed_path(project, update)}
28 - = image_tag gravatar_icon(update.author.email), :class => "left", :width => 40 28 + = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
29 %span.update-title 29 %span.update-title
30 = dashboard_feed_title(update) 30 = dashboard_feed_title(update)
31 %span.update-author 31 %span.update-author
32 - %strong= update.author.name 32 + %strong= update.author_name
33 authored 33 authored
34 = time_ago_in_words(update.created_at) 34 = time_ago_in_words(update.created_at)
35 ago 35 ago
lib/commit_ext.rb
@@ -12,4 +12,12 @@ module CommitExt @@ -12,4 +12,12 @@ module CommitExt
12 def created_at 12 def created_at
13 committed_date 13 committed_date
14 end 14 end
  15 +
  16 + def author_email
  17 + author.email.force_encoding(Encoding::UTF_8)
  18 + end
  19 +
  20 + def author_name
  21 + author.name.force_encoding(Encoding::UTF_8)
  22 + end
15 end 23 end