Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #732 from carols10cents/issue_731

Fixes Issue #548 and #731. Handles cases where author is nil and that ca...
  • Loading branch information...
commit b406ec63763aeaf5da7fff80050ad7ef76cf5977 2 parents b64c263 + abde4c9
@steveklabnik steveklabnik authored
Showing with 30 additions and 9 deletions.
  1. +13 −9 app/views/updates/_list.html.haml
  2. +17 −0 test/acceptance/update_test.rb
View
22 app/views/updates/_list.html.haml
@@ -6,14 +6,15 @@
- unless defined?(no_highlight) and no_highlight
- mine = current_user.nil? ? false : (update.author.user == current_user)
- mentioned = current_user.nil? ? false : update.mentioned?(current_user.username)
- %li.update.hentry.message{:class => (mentioned ? "mention " : "") + (mine ? "mine " : ""), :id => "update-#{update.id}", "data-id" => update.id, "data-name" => update.author.fully_qualified_name}
- .author.vcard
- %a.url{:href => update.author.url, :rel => "user"}
- = AuthorDecorator.decorate(update.author).avatar
- %span.fn
- %a.url{:href => update.author.url}
- = update.author.display_name
- (<span class="nickname user-text">#{update.author.username}</span>)
+ %li.update.hentry.message{:class => (mentioned ? "mention " : "") + (mine ? "mine " : ""), :id => "update-#{update.id}", "data-id" => update.id, "data-name" => update.author ? update.author.fully_qualified_name : ""}
+ - if update.author
+ .author.vcard
+ %a.url{:href => update.author.url, :rel => "user"}
+ = AuthorDecorator.decorate(update.author).avatar
+ %span.fn
+ %a.url{:href => update.author.url}
+ = update.author.display_name
+ (<span class="nickname user-text">#{update.author.username}</span>)
.entry-content
%span.message-text
!= update.to_html
@@ -25,7 +26,10 @@
%span.in-reply
%a{:href => "/updates/#{update.referral.id}"}
in reply to
- %span.name= update.referral.author.username
+ - if update.referral.author
+ %span.name= update.referral.author.username
+ - else
+ an update
- elsif !update.referral_url.nil?
%span.in-reply
%a{:href => update.referral_url}
View
17 test/acceptance/update_test.rb
@@ -106,6 +106,23 @@
end
end
+ it "shows an update in reply to another update that has a nil author" do
+ # Not sure how this happens, but it does. author_id exists but the
+ # associated author does not.
+ update = Fabricate(:update, :author_id => "999999")
+
+ update2 = Fabricate(:update)
+ update2.referral_id = update.id
+ update2.save
+
+ visit "/updates"
+
+ within "#page" do
+ text.must_include update2.text
+ text.must_include update.text
+ end
+ end
+
describe "update with hashtag" do
it "creates a working hashtag link" do
log_in_as_some_user
Please sign in to comment.
Something went wrong with that request. Please try again.