diff --git a/app/controllers/tag_controller.rb b/app/controllers/tag_controller.rb index 670c9a929e..6a3a3ab9cc 100644 --- a/app/controllers/tag_controller.rb +++ b/app/controllers/tag_controller.rb @@ -347,9 +347,10 @@ def rss end def rss_for_tagged_with_author - @user = User.find_by(name: params[:author]) - @notes = Tag.tagged_nodes_by_author([params[:tagname]], @user) - .limit(20) + @user = User.find_by(name: params[:authorname]) + @notes = Tag.tagged_nodes_by_author(params[:tagname], @user) + .where(status: 1) + .limit(20) respond_to do |format| format.rss do response.headers['Content-Type'] = 'application/xml; charset=utf-8' diff --git a/app/views/tag/rss.rss.builder b/app/views/tag/rss.rss.builder index 97cf7cc3f1..200fff25fc 100644 --- a/app/views/tag/rss.rss.builder +++ b/app/views/tag/rss.rss.builder @@ -1,19 +1,20 @@ -xml.instruct! :xml, :version => "1.0" -xml.rss :version => "2.0" do +xml.rss :version => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom' do xml.channel do xml.title "Research tagged '#{params[:tagname]}'" xml.description "Open source environmental science research at Public Lab" xml.link "https://#{request.host}/feed/tag/"+params[:tagname]+".rss" @notes.each do |node| - + body = node.body - body = "
"+node.body if node.main_image - - xml.item do - xml.title node.title - xml.author node.author.name - if node.power_tag('date') != '' + author = node.author.username + if node.author.user.has_power_tag('twitter') + author = "@#{node.author.user.get_value_of_power_tag('twitter')}" + end + xml.item do + xml.title node.title + xml.author author + if node.power_tag('date') != '' begin xml.pubDate DateTime.strptime(node.power_tag('date'), "%m-%d-%Y").rfc822 rescue @@ -22,10 +23,12 @@ xml.rss :version => "2.0" do else xml.pubDate node.created_at.to_s(:rfc822) end - #xml.link url_for :only_path => false, :controller => 'notes', :action => 'show', :id => node.nid xml.link "https://" + request.host.to_s + node.path - #xml.image "//#{ request.host }/"+node.main_image.path(:default) if node.main_image - xml.description auto_link(node.latest.render_body, :sanitize => false) + if node.main_image + xml.description { xml.cdata!("#{node.main_image.title}

#{auto_link(node.latest.render_body, :sanitize => false)}

") } + else + xml.description { xml.cdata!("PublicLab

#{auto_link(node.latest.render_body, :sanitize => false)}

") } + end xml.guid url_for :only_path => false, :controller => 'notes', :action => 'show', :id => node.nid end end diff --git a/app/views/tag/rss_for_tagged_with_author.rss.builder b/app/views/tag/rss_for_tagged_with_author.rss.builder index 38c83fe523..989217467d 100644 --- a/app/views/tag/rss_for_tagged_with_author.rss.builder +++ b/app/views/tag/rss_for_tagged_with_author.rss.builder @@ -1,21 +1,19 @@ xml.rss :version => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom' do xml.channel do - xml.title "Research tagged '#{params[:tagname]}' by #{params[:authorname]}" + xml.title "Research tagged '#{params[:tagname]}' by '#{params[:authorname]}'" xml.description "Open source environmental science research at Public Lab" - xml.link "https://#{request.host}/feed/tag/"+params[:tagname]+"/author/"+"params[:authorname]"+".rss" + xml.link "https://#{request.host}/feed/tag/"+params[:tagname]+"/author/"+params[:authorname]+".rss" @notes.each do |node| - body = node.body - uname = node.author.username - email = node.author.email - if node.author.user.has_power_tag('twitter') - uname = node.author.user.get_value_of_power_tag('twitter') - end - author_format = "@#{uname} (#{email})" - xml.item do - xml.title " #{node.title}" - xml.author author_format + body = node.body + author = node.author.username + if node.author.user.has_power_tag('twitter') + author = "@#{node.author.user.get_value_of_power_tag('twitter')}" + end + xml.item do + xml.title node.title + xml.author author if node.power_tag('date') != '' begin xml.pubDate DateTime.strptime(node.power_tag('date'), "%m-%d-%Y").rfc822 @@ -27,9 +25,9 @@ xml.rss :version => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom' do end xml.link "https://" + request.host.to_s + node.path if node.main_image - xml.description { xml.cdata!("#{node.main_image.title}") } + xml.description { xml.cdata!("#{node.main_image.title}

#{auto_link(node.latest.render_body, :sanitize => false)}

") } else - xml.description { xml.cdata!("PublicLab

#{body}

") } + xml.description { xml.cdata!("PublicLab

#{auto_link(node.latest.render_body, :sanitize => false)}

") } end xml.guid url_for :only_path => false, :controller => 'notes', :action => 'show', :id => node.nid end