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