moved user's public route to user controller. changed person.public_url to reflect change.

This commit is contained in:
danielvincent 2010-09-27 22:30:16 -07:00
parent 500e6cc4cf
commit 15a4609c14
4 changed files with 16 additions and 14 deletions

View file

@ -4,7 +4,6 @@
class PublicsController < ApplicationController class PublicsController < ApplicationController
require File.expand_path('../../../lib/diaspora/parser', __FILE__) require File.expand_path('../../../lib/diaspora/parser', __FILE__)
require File.expand_path('../../../lib/diaspora/ostatus_builder', __FILE__)
include Diaspora::Parser include Diaspora::Parser
layout false layout false
@ -42,13 +41,4 @@ class PublicsController < ApplicationController
@user.receive_salmon params[:xml] @user.receive_salmon params[:xml]
end end
def public
user = User.find_by_username(params[:username])
director = Diaspora::Director.new
ostatus_builder = Diaspora::OstatusBuilder.new(user)
render :xml => director.build(ostatus_builder)
end
end end

View file

@ -3,7 +3,9 @@
# the COPYRIGHT file. # the COPYRIGHT file.
class UsersController < ApplicationController class UsersController < ApplicationController
before_filter :authenticate_user!, :except => [:new, :create] require File.expand_path('../../../lib/diaspora/ostatus_builder', __FILE__)
before_filter :authenticate_user!, :except => [:new, :create, :public]
respond_to :html respond_to :html
@ -27,6 +29,14 @@ class UsersController < ApplicationController
respond_with(@user, :location => root_url) respond_with(@user, :location => root_url)
end end
def public
user = User.find_by_username(params[:username])
director = Diaspora::Director.new
ostatus_builder = Diaspora::OstatusBuilder.new(user)
render :xml => director.build(ostatus_builder)
end
private private
def prep_image_url(params) def prep_image_url(params)
url = APP_CONFIG[:pod_url].chop if APP_CONFIG[:pod_url][-1,1] == '/' url = APP_CONFIG[:pod_url].chop if APP_CONFIG[:pod_url][-1,1] == '/'

View file

@ -50,7 +50,7 @@ class Person
end end
def public_url def public_url
"#{self.url}users/#{self.id}/public" "#{self.url}users/#{self.owner.username}/public"
end end

View file

@ -4,12 +4,15 @@
Diaspora::Application.routes.draw do Diaspora::Application.routes.draw do
resources :people, :only => [:index, :show, :destroy] resources :people, :only => [:index, :show, :destroy]
resources :users, :except => [:create, :new, :show]
resources :status_messages, :only => [:create, :destroy, :show] resources :status_messages, :only => [:create, :destroy, :show]
resources :comments, :except => [:index] resources :comments, :except => [:index]
resources :requests, :except => [:edit, :update] resources :requests, :except => [:edit, :update]
resources :photos, :except => [:index] resources :photos, :except => [:index]
resources :albums resources :albums
# added public route to user
match 'users/:username/public', :to => 'users#public'
resources :users, :except => [:create, :new, :show]
match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends' match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends'
match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend' match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend'
@ -36,7 +39,6 @@ Diaspora::Application.routes.draw do
match 'get_to_the_choppa', :to => redirect("/signup") match 'get_to_the_choppa', :to => redirect("/signup")
#public routes #public routes
# #
match 'public/:username', :to => 'publics#public'
match 'webfinger', :to => 'publics#webfinger' match 'webfinger', :to => 'publics#webfinger'
match 'hcard/users/:id', :to => 'publics#hcard' match 'hcard/users/:id', :to => 'publics#hcard'