Skip to content
Extraits de code Groupes Projets
Valider e2cb572c rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

random cleanup; delete some unused methods, clean up some logic in some

controllers; update the default referee to /stream [ci skip]
parent c100f8bf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base
:open_publisher
def ensure_http_referer_is_set
request.env['HTTP_REFERER'] ||= '/aspects'
request.env['HTTP_REFERER'] ||= '/stream'
end
# Overwriting the sign_out redirect path method
......@@ -63,6 +63,10 @@ class ApplicationController < ActionController::Base
@only_sharing_count ||= current_user.contacts.only_sharing.count
end
def tags
@tags ||= current_user.followed_tags
end
def ensure_page
params[:page] = params[:page] ? params[:page].to_i : 1
end
......@@ -115,19 +119,6 @@ class ApplicationController < ActionController::Base
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : multi_stream_path)
end
def tag_followings
if current_user
if @tag_followings == nil
@tag_followings = current_user.tag_followings
end
@tag_followings
end
end
def tags
@tags ||= current_user.followed_tags
end
def max_time
params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now + 1
end
......
......@@ -16,7 +16,6 @@ class PublicsController < ApplicationController
# newrelic_ignore if EnviromentConfiguration.using_new_relic?
skip_before_filter :set_header_data
skip_before_filter :which_action_and_user
skip_before_filter :set_grammatical_gender
before_filter :allow_cross_origin, :only => [:hcard, :host_meta, :webfinger]
before_filter :check_for_xml, :only => [:receive, :receive_public]
......@@ -25,22 +24,14 @@ class PublicsController < ApplicationController
respond_to :html
respond_to :xml, :only => :post
def allow_cross_origin
headers["Access-Control-Allow-Origin"] = "*"
end
layout false
caches_page :host_meta
def hcard
@person = Person.where(:guid => params[:guid]).first
if @person && @person.closed_account?
render :nothing => true, :status => 404
return
end
@person = Person.find_by_guid_and_closed_account(params[:guid], false)
unless @person.nil? || @person.owner.nil?
if @person.present? && @person.local?
render 'publics/hcard'
else
render :nothing => true, :status => 404
......@@ -54,16 +45,12 @@ class PublicsController < ApplicationController
def webfinger
@person = Person.local_by_account_identifier(params[:q]) if params[:q]
if @person && @person.closed_account?
if @person.nil? || @person.closed_account?
render :nothing => true, :status => 404
return
end
unless @person.nil?
render 'webfinger', :content_type => 'application/xrd+xml'
else
render :nothing => true, :status => 404
end
render 'webfinger', :content_type => 'application/xrd+xml'
end
def hub
......@@ -76,7 +63,7 @@ class PublicsController < ApplicationController
end
def receive
person = Person.where(:guid => params[:guid]).first
person = Person.find_by_guid(params[:guid])
if person.nil? || person.owner_id.nil?
Rails.logger.error("Received post for nonexistent person #{params[:guid]}")
......@@ -91,6 +78,12 @@ class PublicsController < ApplicationController
end
def allow_cross_origin
headers["Access-Control-Allow-Origin"] = "*"
end
private
def check_for_xml
......
......@@ -5,7 +5,6 @@ require File.join(Rails.root, 'app', 'models', 'acts_as_taggable_on', 'tag')
require File.join(Rails.root, 'lib', 'stream', 'tag')
class TagsController < ApplicationController
skip_before_filter :which_action_and_user
skip_before_filter :set_grammatical_gender
before_filter :ensure_page, :only => :show
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter