mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 12:12:26 +08:00
introduce strong_parameters
This commit is contained in:
parent
ea294f71c2
commit
661ddbb158
1
Gemfile
1
Gemfile
|
@ -61,6 +61,7 @@ gem 'seed-fu'
|
|||
gem 'sidekiq'
|
||||
gem 'sinatra', require: nil
|
||||
gem 'slim' # required for sidekiq-web
|
||||
gem 'strong_parameters' # remove when we upgrade to Rails 4
|
||||
gem 'therubyracer', require: 'v8'
|
||||
gem 'thin'
|
||||
gem 'diffy', require: false
|
||||
|
|
|
@ -434,6 +434,10 @@ GEM
|
|||
slop (3.4.4)
|
||||
sorcerer (0.3.10)
|
||||
spork (0.9.2)
|
||||
strong_parameters (0.2.1)
|
||||
actionpack (~> 3.0)
|
||||
activemodel (~> 3.0)
|
||||
railties (~> 3.0)
|
||||
temple (0.6.4)
|
||||
terminal-notifier-guard (1.5.3)
|
||||
therubyracer (0.11.4)
|
||||
|
@ -542,6 +546,7 @@ DEPENDENCIES
|
|||
sinatra
|
||||
slim
|
||||
sprockets!
|
||||
strong_parameters
|
||||
terminal-notifier-guard
|
||||
therubyracer
|
||||
thin
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class UserActionsController < ApplicationController
|
||||
def index
|
||||
requires_parameters(:username)
|
||||
params.require(:username)
|
||||
params.permit(:filter, :offset)
|
||||
|
||||
per_chunk = 60
|
||||
|
||||
user = fetch_user_from_params
|
||||
|
@ -26,7 +28,7 @@ class UserActionsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
requires_parameters(:id)
|
||||
params.require(:id)
|
||||
render json: UserAction.stream_item(params[:id], guardian)
|
||||
end
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@ require 'spec_helper'
|
|||
describe UserActionsController do
|
||||
context 'index' do
|
||||
|
||||
it 'fails if username is not specified' do
|
||||
expect { xhr :get, :index }.to raise_error
|
||||
end
|
||||
|
||||
it 'renders list correctly' do
|
||||
ActiveRecord::Base.observers.enable :all
|
||||
post = Fabricate(:post)
|
||||
|
|
Loading…
Reference in New Issue
Block a user