Include reshares in the public user feed, closes #1781

This commit is contained in:
Jonne Haß 2013-01-31 15:58:23 +01:00
parent 0fd3bcb397
commit 35350d1ceb
4 changed files with 9 additions and 1 deletions

View file

@ -3,6 +3,7 @@
## Features ## Features
* Deleting a post that was shared to Facebook now deletes it from Facebook too [#3980]( https://github.com/diaspora/diaspora/pull/3980) * Deleting a post that was shared to Facebook now deletes it from Facebook too [#3980]( https://github.com/diaspora/diaspora/pull/3980)
* Include reshares in a users public atom feed [#1781](https://github.com/diaspora/diaspora/issues/1781)
## Bug Fixes ## Bug Fixes

View file

@ -103,7 +103,7 @@ class UsersController < ApplicationController
if @user = User.find_by_username(params[:username]) if @user = User.find_by_username(params[:username])
respond_to do |format| respond_to do |format|
format.atom do format.atom do
@posts = StatusMessage.where(:author_id => @user.person_id, :public => true).order('created_at DESC').limit(25) @posts = Post.where(:author_id => @user.person_id, :public => true).order('created_at DESC').limit(25)
end end
format.any { redirect_to person_path(@user.person) } format.any { redirect_to person_path(@user.person) }

View file

@ -28,6 +28,7 @@ atom_feed({'xmlns:thr' => 'http://purl.org/syndication/thread/1.0',
@posts.each do |post| @posts.each do |post|
post = post.absolute_root if post.is_a? Reshare
feed.entry post, :url => "#{@user.url}p/#{post.id}", feed.entry post, :url => "#{@user.url}p/#{post.id}",
:id => "#{@user.url}p/#{post.id}" do |entry| :id => "#{@user.url}p/#{post.id}" do |entry|

View file

@ -54,6 +54,12 @@ describe UsersController do
response.body.should include('a href') response.body.should include('a href')
end end
it 'includes reshares in the atom feed' do
reshare = FactoryGirl.create(:reshare, :author => @user.person)
get :public, :username => @user.username, :format => :atom
response.body.should include reshare.root.raw_message
end
it 'redirects to a profile page if html is requested' do it 'redirects to a profile page if html is requested' do
get :public, :username => @user.username get :public, :username => @user.username
response.should be_redirect response.should be_redirect