Add 'Post.permitted_create_params' to allow plugins to add new params when creating a post

This commit is contained in:
Régis Hanol 2017-08-12 04:10:45 +02:00
parent 962db8c759
commit 4f09a5a7a5
2 changed files with 7 additions and 0 deletions

View File

@ -561,6 +561,10 @@ class PostsController < ApplicationController
:visible
]
if Post.permitted_create_params.present?
permitted.concat(Post.permitted_create_params.to_a)
end
# param munging for WordPress
params[:auto_track] = !(params[:auto_track].to_s == "false") if params[:auto_track]
params[:visible] = (params[:unlist_topic].to_s == "false") if params[:unlist_topic]

View File

@ -17,6 +17,9 @@ class Post < ActiveRecord::Base
include HasCustomFields
include LimitedEdit
cattr_accessor :permitted_create_params
self.permitted_create_params = Set.new
# increase this number to force a system wide post rebake
BAKED_VERSION = 1