mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 16:52:45 +08:00
Add 'Post.permitted_create_params' to allow plugins to add new params when creating a post
This commit is contained in:
parent
962db8c759
commit
4f09a5a7a5
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user