Project

General

Profile

Patch #1796 ยป redmine-map-author-to-name-r1747.patch

map repository authors to redmine login names against r1747 - Bernd Lommerzheim, 2008-08-17 21:52

View differences:

app/models/user.rb (working copy)
265 265
    anonymous_user
266 266
  end
267 267
  
268
  def self.author_to_name(author, formatter = nil)
269
    return author if author == ""
270
    user = find(:first, :conditions => ["login=?", author])
271
    return (user ? user.name(formatter) : author)
272
  end
273
  
268 274
private
269 275
  # Return password digest
270 276
  def self.hash_password(clear_password)
app/controllers/repositories_controller.rb (working copy)
268 268
    changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10
269 269
    
270 270
    # Remove email adress in usernames
271
    fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') }
271
    fields = fields.collect {|c| User.author_to_name(c.gsub(%r{<.+@.+>}, ''))+" " }
272 272
    
273 273
    graph = SVG::Graph::BarHorizontal.new(
274 274
      :height => 400,
app/views/repositories/revision.rhtml (working copy)
22 22
<h2><%= l(:label_revision) %> <%= format_revision(@changeset.revision) %></h2>
23 23

  
24 24
<p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %>
25
<em><%= @changeset.committer.to_s.split('<').first %>, <%= format_time(@changeset.committed_on) %></em></p>
25
<em><%= User.author_to_name(@changeset.committer.to_s.split('<').first) %>, <%= format_time(@changeset.committed_on) %></em></p>
26 26

  
27 27
<%= textilizable @changeset.comments %>
28 28

  
app/views/repositories/_revisions.rhtml (working copy)
17 17
<td class="checkbox"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td>
18 18
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
19 19
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
20
<td class="author"><%=h changeset.committer.to_s.split('<').first %></td>
20
<td class="author"><%=h User.author_to_name(changeset.committer.to_s.split('<').first) %></td>
21 21
<td class="comments"><%= textilizable(changeset.comments) %></td>
22 22
</tr>
23 23
<% line_num += 1 %>
app/views/repositories/_dir_list_content.rhtml (working copy)
17 17
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
18 18
<td class="revision"><%= link_to(format_revision(entry.lastrev.name), :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td>
19 19
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
20
<td class="author"><%=h(entry.lastrev.author.to_s.split('<').first) if entry.lastrev %></td>
20
<td class="author"><%=h(User.author_to_name(entry.lastrev.author.to_s.split('<').first)) if entry.lastrev %></td>
21 21
<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
22 22
<td class="comments"><%=h truncate(changeset.comments, 50) unless changeset.nil? %></td>
23 23
</tr>
app/views/repositories/annotate.rhtml (working copy)
12 12
      <th class="line-num"><%= line_num %></th>
13 13
      <td class="revision">
14 14
      <%= (revision.identifier ? link_to(format_revision(revision.identifier), :action => 'revision', :id => @project, :rev => revision.identifier) : format_revision(revision.revision)) if revision %></td>
15
      <td class="author"><%= h(revision.author.to_s.split('<').first) if revision %></td>
15
      <td class="author"><%= h(User.author_to_name(revision.author.to_s.split('<').first)) if revision %></td>
16 16
      <td class="line-code"><pre><%= line %></pre></td>
17 17
    </tr>
18 18
    <% line_num += 1 %>
app/views/projects/activity.rhtml (working copy)
11 11
  <%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %>
12 12
  <%= link_to format_activity_title(e.event_title), e.event_url %></dt>
13 13
  <dd><span class="description"><%= format_activity_description(e.event_description) %></span>
14
  <span class="author"><%= e.event_author if e.respond_to?(:event_author) %></span></dd>
14
  <span class="author"><%= (e.event_type=="changeset" ? User.author_to_name(e.event_author) : e.event_author) if e.respond_to?(:event_author) %></span></dd>
15 15
<% end -%>
16 16
</dl>
17 17
<% end -%>
    (1-1/1)