[Comments] Remove atom feed

This commit is contained in:
Earlopain 2021-10-02 12:13:27 +02:00
parent 8b3cb8f7ef
commit d9f7bec1ee
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
8 changed files with 2 additions and 48 deletions

View File

@ -5,7 +5,7 @@ class CommentsController < ApplicationController
skip_before_action :api_check
def index
if params[:group_by] == "comment" || request.format == Mime::Type.lookup("application/atom+xml")
if params[:group_by] == "comment"
index_by_comment
else
index_by_post
@ -103,12 +103,7 @@ private
@comments = @comments.undeleted unless CurrentUser.is_moderator?
@comments = @comments.search(search_params).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
@comment_votes = CommentVote.for_comments_and_user(@comments.map(&:id), CurrentUser.id)
respond_with(@comments) do |format|
format.atom do
@comments = @comments.includes(:post, :creator).load
@comments = @comments.select { |comment| comment.post.visible? }
end
end
respond_with(@comments)
end
def check_privilege(comment)

View File

@ -20,5 +20,3 @@
</div>
<%= numbered_paginator(@comments) %>
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(format: "atom"), title: "Comments")) %>

View File

@ -33,5 +33,3 @@
</div>
<%= numbered_paginator(@posts) %>
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(:atom, search: { do_not_bump_post: true }), title: "Comments")) %>

View File

@ -1,25 +0,0 @@
atom_feed(root_url: comments_url(host: Danbooru.config.hostname)) do |feed|
title = "Comments"
title += " by #{params[:search][:creator_name]}" if params.dig(:search, :creator_name).present?
title += " on #{params[:search][:post_tags_match]}" if params.dig(:search, :post_tags_match).present?
title += " on post ##{params[:search][:post_id]}" if params.dig(:search, :post_id).present?
feed.title(title)
feed.updated(@comments.first.try(:updated_at))
@comments.each do |comment|
feed.entry(comment, published: comment.created_at, updated: comment.updated_at) do |entry|
entry.title("@#{comment.creator_name} on post ##{comment.post_id} (#{comment.post.presenter.humanized_essential_tag_string})")
entry.content(<<-EOS.strip_heredoc, type: "html")
<img src="#{comment.post.preview_file_url}"/>
#{format_text(comment.body)}
EOS
entry.author do |author|
author.name(comment.creator_name)
author.uri(user_url(comment.creator))
end
end
end
end

View File

@ -276,9 +276,6 @@
<% if @post.rating == "e" %>
<meta name="rating" content="adult">
<% end %>
<%= auto_discovery_link_tag(:atom, comments_url(:atom, search: { post_id: @post.id }), title: "Comments for post ##{@post.id}") %>
<% end %>
<%= render "posts/partials/common/secondary_links" %>

View File

@ -70,7 +70,6 @@
<ul>
<li><h1>Comments</h1></li>
<li><%= link_to("Listing", comments_path) %></li>
<li><%= link_to("RSS", comments_path(:atom)) %></li>
<li><%= link_to("Help", help_page_path(id: "comments")) %></li>
</ul>
<ul>

View File

@ -42,6 +42,3 @@
<% content_for(:page_title) do %>
User - <%= @presenter.name %>
<% end %>
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(:atom, search: {post_tags_match: "user:#{@user.name}"}), title: "Comments on #{@user.name}'s uploads")) %>
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(:atom, search: {post_tags_match: "commenter:#{@user.name}"}), title: "Comments on posts commented on by #{@user.name}")) %>

View File

@ -35,11 +35,6 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
get comments_path(group_by: "comment")
assert_response :success
end
should "render for atom feeds" do
get comments_path(format: "atom")
assert_response :success
end
end
context "search action" do