Final fixes to /mod (#5234) [deploy]

This commit is contained in:
Ben Halpern 2019-12-23 20:12:14 -05:00 committed by GitHub
parent c70042655f
commit 771fa5b782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 12 deletions

View file

@ -21,15 +21,16 @@
</div>
Posts This Week
</div>
<% plucked_article_ids = Article.cached_tagged_with(@tag).pluck(:id) if @tag %>
<div class="mod-index-hero-data-pod">
<div class="mod-index-hero-data-pod-number">
<%= number_with_delimiter(@tag ? Comment.where(commentable_id: Article.cached_tagged_with(@tag).pluck(:id) ).where("created_at > ?", 7.days.ago).size : Comment.where("created_at > ?", 7.days.ago).size) %>
<%= number_with_delimiter(@tag ? Comment.where(commentable_id: plucked_article_ids ).where("created_at > ?", 7.days.ago).size : Comment.where("created_at > ?", 7.days.ago).size) %>
</div>
Comments This Week
</div>
<div class="mod-index-hero-data-pod">
<div class="mod-index-hero-data-pod-number">
<%= number_with_delimiter(@tag ? Reaction.where(reactable_id: Article.cached_tagged_with(@tag).pluck(:id) ).where("created_at > ?", 7.days.ago).size : Reaction.where("created_at > ?", 7.days.ago).size) %>
<%= number_with_delimiter(@tag ? Reaction.where(reactable_id: plucked_article_ids ).where("created_at > ?", 7.days.ago).size : Reaction.where("created_at > ?", 7.days.ago).size) %>
</div>
Reactions This Week
</div>
@ -58,9 +59,9 @@
</div>
<div class="mod-index-actions-and-details">
<button class="quick-mod-button cta" data-path="<%= article.path %>">Quick Mod</button>
<a href="/<% article.cached_user.username %>"><img src="<%= ProfileImage.new(article.cached_user).get(90) %>" /><%= article.cached_user.name %></a>
<a href="/<%= article.cached_user.username %>"><img src="<%= ProfileImage.new(article.cached_user).get(90) %>" /><%= article.cached_user.name %></a>
・ <%= article.readable_publish_date %>
<% if article.nth_published_by_author < 4 %>
<% if article.nth_published_by_author > 0 && article.nth_published_by_author < 4 %>
・ 👋 <strong><%= article.nth_published_by_author.ordinalize %> post by this user</strong>
<% end %>
</div>

View file

@ -63,16 +63,10 @@ RSpec.describe "Moderations", type: :request do
expect(response.body).to include("We build the")
end
it "grants access to /mod index with articles" do
create(:article, published: true)
get "/mod"
expect(response.body).to include("We build the")
end
it "grants access to /mod index with articles" do
it "grants access to /mod/:tag index with articles" do
create(:article, published: true)
get "/mod/#{article.tags.first}"
expect(response.body).to include("#"+article.tags.first.name.titleize)
expect(response.body).to include("#" + article.tags.first.name.titleize)
end
end
end