Fixes Issue #548 and #731. Handles cases where author is nil and that ca... #732

Merged
merged 1 commit into from Nov 24, 2012

Projects

None yet

2 participants

@carols10cents

...uses errors in the view.

I don't know how update authors get to be nil, but here we are.

@carols10cents carols10cents Fixes Issue #548 and #731. Handles cases where author is nil and that…
… causes errors in the view.

I don't know how update authors get to be nil, but here we are.
abde4c9
@steveklabnik steveklabnik commented on the diff Nov 24, 2012
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 : ""}
@steveklabnik
steveklabnik Nov 24, 2012

whew this line is rough. It already was before, but damn.

@steveklabnik

Seems good for now. Could be better with some presenter-style stuff to handle all this crazy logic, but really that's a step you take after you have the nasty view...

@carols10cents

Yeah I started down the presenter path after fixing this, but got sleepy and decided to just get this in.

@steveklabnik steveklabnik merged commit b406ec6 into hotsh:master Nov 24, 2012

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment