updated before_filters to before_actions as recommended for rails 4

This commit is contained in:
Niall Paterson 2013-11-17 20:20:22 +00:00 committed by Jonne Haß
parent 244388fcb5
commit f33038f105
28 changed files with 48 additions and 49 deletions

View file

@ -6,13 +6,13 @@ class ApplicationController < ActionController::Base
has_mobile_fu
protect_from_forgery :except => :receive
before_filter :ensure_http_referer_is_set
before_filter :set_locale
before_filter :set_diaspora_header
before_filter :set_grammatical_gender
before_filter :mobile_switch
before_filter :gon_set_current_user
before_filter :gon_set_preloads
before_action :ensure_http_referer_is_set
before_action :set_locale
before_action :set_diaspora_header
before_action :set_grammatical_gender
before_action :mobile_switch
before_action :gon_set_current_user
before_action :gon_set_preloads
inflection_method :grammatical_gender => :gender

View file

@ -4,7 +4,7 @@
#
class AspectMembershipsController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
respond_to :html, :json

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file.
class AspectsController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
respond_to :html,
:js,

View file

@ -1,5 +1,5 @@
class BlocksController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
respond_to :html, :json

View file

@ -4,7 +4,7 @@
class CommentsController < ApplicationController
include ApplicationHelper
before_filter :authenticate_user!, :except => [:index]
before_action :authenticate_user!, :except => [:index]
respond_to :html,
:mobile,

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file.
class ContactsController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
use_bootstrap_for :index, :spotlight

View file

@ -4,7 +4,7 @@
#
class ConversationVisibilitiesController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
def destroy
@vis = ConversationVisibility.where(:person_id => current_user.person.id,

View file

@ -1,5 +1,5 @@
class ConversationsController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
layout ->(c) { request.format == :mobile ? "application" : "with_header" }
use_bootstrap_for :index, :show, :new

View file

@ -1,5 +1,5 @@
class InvitationCodesController < ApplicationController
before_filter :ensure_valid_invite_code
before_action :ensure_valid_invite_code
rescue_from ActiveRecord::RecordNotFound do
redirect_to root_url, :notice => "That invite code is no longer valid"

View file

@ -4,7 +4,7 @@
class InvitationsController < ApplicationController
before_filter :authenticate_user!, :only => [:new, :create]
before_action :authenticate_user!, :only => [:new, :create]
def new
@invite_code = current_user.invitation_code

View file

@ -4,7 +4,7 @@
class LikesController < ApplicationController
include ApplicationHelper
before_filter :authenticate_user!
before_action :authenticate_user!
respond_to :html,
:mobile,

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file.
class MessagesController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
respond_to :html, :mobile
respond_to :json, :only => :show

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file.
class NotificationsController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
layout ->(c) { request.format == :mobile ? "application" : "with_header_with_footer" }
use_bootstrap_for :index

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file.
class PeopleController < ApplicationController
before_filter :authenticate_user!, :except => [:show, :last_post]
before_action :authenticate_user!, :except => [:show, :last_post]
use_bootstrap_for :index

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file.
class PhotosController < ApplicationController
before_filter :authenticate_user!, :except => :show
before_action :authenticate_user!, :except => :show
respond_to :html, :json

View file

@ -5,9 +5,8 @@
class PostsController < ApplicationController
include PostsHelper
before_filter :authenticate_user!, :except => [:show, :iframe, :oembed, :interactions]
before_filter :set_format_if_malformed_from_status_net, :only => :show
before_filter :find_post, :only => [:show, :interactions]
before_action :authenticate_user!, :except => [:show, :iframe, :oembed, :interactions]
before_action :set_format_if_malformed_from_status_net, :only => :show
use_bootstrap_for :show

View file

@ -3,8 +3,8 @@
# the COPYRIGHT file.
class ProfilesController < ApplicationController
before_filter :authenticate_user!, :except => ['show']
before_filter -> { @css_framework = :bootstrap }, only: [:show, :edit]
before_action :authenticate_user!, :except => ['show']
before_action -> { @css_framework = :bootstrap }, only: [:show, :edit]
layout ->(c) { request.format == :mobile ? "application" : "with_header_with_footer" }, only: [:show, :edit]

View file

@ -5,10 +5,10 @@
class PublicsController < ApplicationController
include Diaspora::Parser
skip_before_filter :set_header_data
skip_before_filter :set_grammatical_gender
before_filter :check_for_xml, :only => [:receive, :receive_public]
before_filter :authenticate_user!, :only => [:index]
skip_before_action :set_header_data
skip_before_action :set_grammatical_gender
before_action :check_for_xml, :only => [:receive, :receive_public]
before_action :authenticate_user!, :only => [:index]
respond_to :html
respond_to :xml, :only => :post

View file

@ -3,10 +3,10 @@
# the COPYRIGHT file.
class RegistrationsController < Devise::RegistrationsController
before_filter :check_registrations_open_or_valid_invite!, :check_valid_invite!
before_action :check_registrations_open_or_valid_invite!, :check_valid_invite!
layout ->(c) { request.format == :mobile ? "application" : "with_header" }, :only => [:new]
before_filter -> { @css_framework = :bootstrap }, only: [:new, :create]
before_action -> { @css_framework = :bootstrap }, only: [:new, :create]
def create
@user = User.build(user_params)

View file

@ -1,5 +1,5 @@
class ResharesController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
respond_to :json
def create

View file

@ -1,5 +1,5 @@
class SearchController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
def search
if search_query.starts_with?('#')

View file

@ -5,10 +5,10 @@ class ServicesController < ApplicationController
# We need to take a raw POST from an omniauth provider with no authenticity token.
# See https://github.com/intridea/omniauth/issues/203
# See also http://www.communityguides.eu/articles/16
skip_before_filter :verify_authenticity_token, :only => :create
before_filter :authenticate_user!
before_filter :abort_if_already_authorized, :abort_if_read_only_access, :only => :create
before_filter -> { @css_framework = :bootstrap }, only: [:index]
skip_before_action :verify_authenticity_token, :only => :create
before_action :authenticate_user!
before_action :abort_if_already_authorized, :abort_if_read_only_access, :only => :create
before_action -> { @css_framework = :bootstrap }, only: [:index]
layout ->(c) { request.format == :mobile ? "application" : "with_header_with_footer" }, only: [:index]

View file

@ -4,7 +4,7 @@
#
class ShareVisibilitiesController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
def update
#note :id references a postvisibility

View file

@ -3,9 +3,9 @@
# the COPYRIGHT file.
class StatusMessagesController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
before_filter :remove_getting_started, :only => [:create]
before_action :remove_getting_started, :only => [:create]
use_bootstrap_for :bookmarklet

View file

@ -3,9 +3,9 @@
# the COPYRIGHT file.
class StreamsController < ApplicationController
before_filter :authenticate_user!
before_filter :save_selected_aspects, :only => :aspects
before_filter :redirect_unless_admin, :only => :public
before_action :authenticate_user!
before_action :save_selected_aspects, :only => :aspects
before_action :redirect_unless_admin, :only => :public
respond_to :html,
:mobile,

View file

@ -4,7 +4,7 @@
#
class TagFollowingsController < ApplicationController
before_filter :authenticate_user!
before_action :authenticate_user!
respond_to :json

View file

@ -3,8 +3,8 @@
# the COPYRIGHT file.
class TagsController < ApplicationController
skip_before_filter :set_grammatical_gender
before_filter :ensure_page, :only => :show
skip_before_action :set_grammatical_gender
before_action :ensure_page, :only => :show
helper_method :tag_followed?

View file

@ -3,8 +3,8 @@
# the COPYRIGHT file.
class UsersController < ApplicationController
before_filter :authenticate_user!, :except => [:new, :create, :public, :user_photo]
before_filter -> { @css_framework = :bootstrap }, only: [:privacy_settings, :edit]
before_action :authenticate_user!, :except => [:new, :create, :public, :user_photo]
before_action -> { @css_framework = :bootstrap }, only: [:privacy_settings, :edit]
layout ->(c) { request.format == :mobile ? "application" : "with_header_with_footer" }, only: [:privacy_settings, :edit]