fixed public route not fetching posts, also an error in status_message activity markup
This commit is contained in:
parent
eafa965504
commit
f9279f9bbc
7 changed files with 22 additions and 6 deletions
|
|
@ -17,6 +17,7 @@ class StatusMessagesController < ApplicationController
|
|||
public_flag = params[:status_message][:public]
|
||||
public_flag.to_s.match(/(true)|(on)/) ? public_flag = true : public_flag = false
|
||||
params[:status_message][:public] = public_flag
|
||||
puts public_flag
|
||||
|
||||
@status_message = current_user.build_post(:status_message, params[:status_message])
|
||||
aspects = current_user.aspects_from_ids(params[:aspect_ids])
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ class UsersController < ApplicationController
|
|||
|
||||
render :xml => director.build(ostatus_builder), :content_type => 'application/atom+xml'
|
||||
else
|
||||
flash[:error] = I18n.t 'users.public.does_not_exist', :username => params[:username]
|
||||
redirect_to root_url
|
||||
redirect_to root_url, :error => I18n.t('users.public.does_not_exist', :username => params[:username])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class StatusMessage < Post
|
|||
<entry>
|
||||
<title>#{x(self.formatted_message(:plain_text => true))}</title>
|
||||
<link rel="alternate" type="text/html" href="#{self.author.url}status_messages/#{self.id}"/>
|
||||
<id>#{person.url}posts/#{self.id}</id>
|
||||
<id>#{self.author.url}posts/#{self.id}</id>
|
||||
<published>#{self.created_at.xmlschema}</published>
|
||||
<updated>#{self.updated_at.xmlschema}</updated>
|
||||
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Diaspora::Application.routes.draw do
|
|||
|
||||
|
||||
# added public route to user
|
||||
match 'public/:username', :to => 'users#public'
|
||||
match 'public/:username', :to => 'users#public', :as => 'users_public'
|
||||
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
|
||||
match 'getting_started_completed', :to => 'users#getting_started_completed'
|
||||
match 'users/export', :to => 'users#export'
|
||||
|
|
|
|||
|
|
@ -23,13 +23,14 @@ module Diaspora
|
|||
|
||||
def initialize(user)
|
||||
@user = user
|
||||
@posts = Post.where(:author_id => @user.person.id, :public => true)
|
||||
end
|
||||
|
||||
def create_headers
|
||||
<<-XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/">
|
||||
<generator uri="http://joindiaspora.com/">Diaspora</generator>
|
||||
<generator uri="#{AppConfig[:pod_url]}">Diaspora</generator>
|
||||
<id>#{@user.public_url}.atom</id>
|
||||
<title>#{x(@user.name)}'s Public Feed</title>
|
||||
<subtitle>Posts from Diaspora</subtitle>
|
||||
|
|
@ -61,7 +62,7 @@ module Diaspora
|
|||
end
|
||||
|
||||
def create_body
|
||||
@user.visible_posts(:author_id => @user.person.id, :public=>true).inject("") do |xml,curr|
|
||||
@posts.inject("") do |xml,curr|
|
||||
if curr.respond_to?(:to_activity)
|
||||
unless xml
|
||||
curr.to_activity
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ describe UsersController do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#public' do
|
||||
it 'renders xml' do
|
||||
sm = Factory(:status_message, :public => true, :author => @user.person)
|
||||
get :public, :username => @user.username
|
||||
response.body.should include(sm.message)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#update' do
|
||||
before do
|
||||
@params = { :id => @user.id,
|
||||
|
|
|
|||
|
|
@ -199,6 +199,13 @@ STR
|
|||
@marshalled.diaspora_handle.should == @message.diaspora_handle
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#to_activity' do
|
||||
it 'should render a string' do
|
||||
@message.to_activity.should_not be_blank
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'youtube' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue