2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-04 01:15:08 +08:00
discourse/app/controllers/form_templates_controller.rb
Martin Brennan 6e8570b0fb
DEV: Rename experimental_ upcoming change settings (#37589)
We can use the status of upcoming changes to indicate
whether they are experimental or not, having experimental
in the setting name is redundant.

Migrates the settings and the upcoming change events,
updates code, and updates yaml translation keys.
2026-02-10 10:34:37 +10:00

31 lines
750 B
Ruby

# frozen_string_literal: true
class FormTemplatesController < ApplicationController
requires_login
before_action :ensure_form_templates_enabled
def index
form_templates = FormTemplate.all.order(:id)
render_serialized(form_templates, FormTemplateSerializer, root: "form_templates")
end
def show
params.require(:id)
template = FormTemplate.find_by(id: params[:id])
raise Discourse::NotFound if template.nil?
template.process!(guardian)
render_serialized(template, FormTemplateSerializer, root: "form_template")
end
private
def ensure_form_templates_enabled
unless UpcomingChanges.enabled_for_user?(:enable_form_templates, current_user)
raise Discourse::InvalidAccess.new
end
end
end