Check if author_id is nil before querying for author (#1325)
* Check if author_id is nil before querying for author * Remove some legacy code * Remove tests that test for unused functionality
This commit is contained in:
parent
73ddff4549
commit
b3f2789eb2
3 changed files with 1 additions and 38 deletions
|
|
@ -34,30 +34,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @tag == "javascript" %>
|
||||
<div class="widget sponsorship-widget <%= "showing" unless user_signed_in? %>" id="sponsorship-widget">
|
||||
<header>
|
||||
<a href="/sponsors">community sponsors</a>
|
||||
<span class="emoji">
|
||||
<img alt="emoji heart" src="<%= asset_path "emoji/emoji-one-heart.png" %>" />
|
||||
</span>
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<div class="sidebar-sponsor">
|
||||
<a class="partner-link" href="https://developer.jwplayer.com/jw-player/demos/?utm_source=dev.to" target="_blank" data-details="jwplayer__image">
|
||||
<img src="<%= cloudinary("https://thepracticaldev.s3.amazonaws.com/i/lc2gkdj9dbmkul4z26g0.png") %>" style="margin-bottom:8px;" alt="Cloudinary K" />
|
||||
|
||||
</a>
|
||||
<div class="sponsor-tagline" style="display:inline;">
|
||||
The Most Powerful & Flexible JavaScript Video API.
|
||||
<a class="partner-link sponsor-learn-more" href="https://developer.jwplayer.com/jw-player/demos/?utm_source=dev.to" target="_blank" data-details="jwplayer__learn-more">
|
||||
Learn More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="sidebar-data">
|
||||
<div>
|
||||
<%= pluralize Article.tagged_with(@tag).where(published: true).size, "Post" %> Published
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<% if article.user&.notes&.any? %>
|
||||
<h2>User Notes (<%= article.user&.notes.size %> total)</h2>
|
||||
<% article.user&.notes&.last(3).each do |note| %>
|
||||
<p><em><%= note.created_at.strftime("%d %B %Y %H:%M UTC") %> by <%= User.find(note.author_id).username %></em> - <%= note.content %></p>
|
||||
<p><em><%= note.created_at.strftime("%d %B %Y %H:%M UTC") %> by <%= note.author_id ? User.find(note.author_id).username : "No Author" %></em> - <%= note.content %></p>
|
||||
<% end %>
|
||||
<p><a href="/internal/users/<%= article.user_id %>">View All</a></p>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -49,19 +49,6 @@ describe "User visits articles by tag", type: :feature do
|
|||
expect(page).not_to have_text(article2.title)
|
||||
end
|
||||
end
|
||||
|
||||
it "displays community sponsors" do
|
||||
within("#sponsorship-widget") do
|
||||
expect(page).to have_link("community sponsors", href: "/sponsors")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when choosing non-js tag" do
|
||||
it "doesn't display sponsors" do
|
||||
visit "/t/IoT"
|
||||
expect(page).not_to have_selector("#sponsorship-widget")
|
||||
end
|
||||
end
|
||||
|
||||
context "when user has logged in" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue