Skip to content

Commit

Permalink
use github username when full name is blank - closes ryanb#36
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb committed Aug 18, 2011
1 parent 24bcaec commit 4dee54c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def generate_token(column)
end

def display_name
name || github_username
name.present? ? name : github_username
end

def banned?
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% title "#{@user.name}'s Profile" %>
<% title "#{@user.display_name}'s Profile" %>

<div class="content">
<% if @user == current_user %>
Expand Down
4 changes: 4 additions & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@
user.reload.unsubscribe_token.should eq(token)
user.generated_unsubscribe_token.should eq(token)
end

it "uses github name as display name when original is blank" do
Factory(:user, :name => "", :github_username => "hank").display_name.should eq("hank")
end
end

0 comments on commit 4dee54c

Please sign in to comment.