random cleanup; delete some unused methods, clean up some logic in some
controllers; update the default referee to /stream [ci skip]
This commit is contained in:
parent
c100f8bfdd
commit
e2cb572c15
3 changed files with 16 additions and 33 deletions
|
|
@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base
|
||||||
:open_publisher
|
:open_publisher
|
||||||
|
|
||||||
def ensure_http_referer_is_set
|
def ensure_http_referer_is_set
|
||||||
request.env['HTTP_REFERER'] ||= '/aspects'
|
request.env['HTTP_REFERER'] ||= '/stream'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Overwriting the sign_out redirect path method
|
# Overwriting the sign_out redirect path method
|
||||||
|
|
@ -63,6 +63,10 @@ class ApplicationController < ActionController::Base
|
||||||
@only_sharing_count ||= current_user.contacts.only_sharing.count
|
@only_sharing_count ||= current_user.contacts.only_sharing.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tags
|
||||||
|
@tags ||= current_user.followed_tags
|
||||||
|
end
|
||||||
|
|
||||||
def ensure_page
|
def ensure_page
|
||||||
params[:page] = params[:page] ? params[:page].to_i : 1
|
params[:page] = params[:page] ? params[:page].to_i : 1
|
||||||
end
|
end
|
||||||
|
|
@ -115,19 +119,6 @@ class ApplicationController < ActionController::Base
|
||||||
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : multi_stream_path)
|
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : multi_stream_path)
|
||||||
end
|
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
|
def max_time
|
||||||
params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now + 1
|
params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now + 1
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ class PublicsController < ApplicationController
|
||||||
# newrelic_ignore if EnviromentConfiguration.using_new_relic?
|
# newrelic_ignore if EnviromentConfiguration.using_new_relic?
|
||||||
|
|
||||||
skip_before_filter :set_header_data
|
skip_before_filter :set_header_data
|
||||||
skip_before_filter :which_action_and_user
|
|
||||||
skip_before_filter :set_grammatical_gender
|
skip_before_filter :set_grammatical_gender
|
||||||
before_filter :allow_cross_origin, :only => [:hcard, :host_meta, :webfinger]
|
before_filter :allow_cross_origin, :only => [:hcard, :host_meta, :webfinger]
|
||||||
before_filter :check_for_xml, :only => [:receive, :receive_public]
|
before_filter :check_for_xml, :only => [:receive, :receive_public]
|
||||||
|
|
@ -25,22 +24,14 @@ class PublicsController < ApplicationController
|
||||||
respond_to :html
|
respond_to :html
|
||||||
respond_to :xml, :only => :post
|
respond_to :xml, :only => :post
|
||||||
|
|
||||||
def allow_cross_origin
|
|
||||||
headers["Access-Control-Allow-Origin"] = "*"
|
|
||||||
end
|
|
||||||
|
|
||||||
layout false
|
layout false
|
||||||
caches_page :host_meta
|
caches_page :host_meta
|
||||||
|
|
||||||
def hcard
|
def hcard
|
||||||
@person = Person.where(:guid => params[:guid]).first
|
@person = Person.find_by_guid_and_closed_account(params[:guid], false)
|
||||||
|
|
||||||
if @person && @person.closed_account?
|
if @person.present? && @person.local?
|
||||||
render :nothing => true, :status => 404
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
unless @person.nil? || @person.owner.nil?
|
|
||||||
render 'publics/hcard'
|
render 'publics/hcard'
|
||||||
else
|
else
|
||||||
render :nothing => true, :status => 404
|
render :nothing => true, :status => 404
|
||||||
|
|
@ -54,16 +45,12 @@ class PublicsController < ApplicationController
|
||||||
def webfinger
|
def webfinger
|
||||||
@person = Person.local_by_account_identifier(params[:q]) if params[:q]
|
@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
|
render :nothing => true, :status => 404
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
unless @person.nil?
|
render 'webfinger', :content_type => 'application/xrd+xml'
|
||||||
render 'webfinger', :content_type => 'application/xrd+xml'
|
|
||||||
else
|
|
||||||
render :nothing => true, :status => 404
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def hub
|
def hub
|
||||||
|
|
@ -76,7 +63,7 @@ class PublicsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive
|
def receive
|
||||||
person = Person.where(:guid => params[:guid]).first
|
person = Person.find_by_guid(params[:guid])
|
||||||
|
|
||||||
if person.nil? || person.owner_id.nil?
|
if person.nil? || person.owner_id.nil?
|
||||||
Rails.logger.error("Received post for nonexistent person #{params[:guid]}")
|
Rails.logger.error("Received post for nonexistent person #{params[:guid]}")
|
||||||
|
|
@ -91,6 +78,12 @@ class PublicsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def allow_cross_origin
|
||||||
|
headers["Access-Control-Allow-Origin"] = "*"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_for_xml
|
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')
|
require File.join(Rails.root, 'lib', 'stream', 'tag')
|
||||||
|
|
||||||
class TagsController < ApplicationController
|
class TagsController < ApplicationController
|
||||||
skip_before_filter :which_action_and_user
|
|
||||||
skip_before_filter :set_grammatical_gender
|
skip_before_filter :set_grammatical_gender
|
||||||
before_filter :ensure_page, :only => :show
|
before_filter :ensure_page, :only => :show
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue