Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-21 17:00:29 +01:00
COMPATIBILITY: more linting
Dieser Commit ist enthalten in:
Ursprung
f042f6b9b8
Commit
95aba3c9c5
18 geänderte Dateien mit 88 neuen und 72 gelöschten Zeilen
|
@ -17,3 +17,9 @@ Discourse/TimeEqMatcher:
|
|||
|
||||
Discourse/NoAddReferenceOrAliasesActiveRecordMigration:
|
||||
Enabled: false
|
||||
|
||||
Lint/BooleanSymbol:
|
||||
Enabled: false
|
||||
|
||||
Discourse/Plugins/NoMonkeyPatching:
|
||||
Enabled: false
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::AdminController < ::Admin::AdminController
|
||||
before_action :ensure_admin
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::AdminApiController < CustomWizard::AdminController
|
||||
skip_before_action :check_xhr, only: [:redirect]
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def list
|
||||
serializer =
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::AdminCustomFieldsController < CustomWizard::AdminController
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def index
|
||||
render_json_dump(custom_fields: custom_field_list)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::AdminLogsController < CustomWizard::AdminController
|
||||
before_action :find_wizard, except: [:index]
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def index
|
||||
render json:
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
class CustomWizard::AdminManagerController < CustomWizard::AdminController
|
||||
skip_before_action :check_xhr, only: [:export]
|
||||
before_action :get_wizard_ids, except: [:import]
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def export
|
||||
templates = []
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
class CustomWizard::AdminSubmissionsController < CustomWizard::AdminController
|
||||
skip_before_action :preload_json, :check_xhr, only: [:download]
|
||||
before_action :find_wizard, except: [:index]
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def index
|
||||
render json:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::SubscriptionController < ::Admin::AdminController
|
||||
before_action :ensure_admin
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def index
|
||||
if params[:update_from_remote]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
||||
before_action :find_wizard, only: %i[show remove]
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def index
|
||||
render_json_dump(
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CustomWizard::RealtimeValidationsController < ::ApplicationController
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def validate
|
||||
klass_str = "CustomWizard::RealtimeValidation::#{validation_params[:type].camelize}"
|
||||
result = klass_str.constantize.new(current_user).perform(validation_params)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::StepsController < ::CustomWizard::WizardClientController
|
||||
before_action :ensure_can_update
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def update
|
||||
update = update_params.to_h
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::WizardController < ::CustomWizard::WizardClientController
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
def show
|
||||
if wizard.present?
|
||||
render json: CustomWizard::WizardSerializer.new(wizard, scope: guardian, root: false).as_json,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
class CustomWizard::WizardClientController < ::ApplicationController
|
||||
before_action :ensure_plugin_enabled
|
||||
before_action :set_builder
|
||||
requires_plugin "discourse-custom-wizard"
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ class CustomWizard::Api::Authorization
|
|||
include ActiveModel::SerializerSupport
|
||||
|
||||
attr_accessor :api_name,
|
||||
:authorized,
|
||||
:auth_type,
|
||||
:auth_url,
|
||||
:token_url,
|
||||
|
|
|
@ -8,7 +8,6 @@ class CustomWizard::Field
|
|||
:type,
|
||||
:required,
|
||||
:value,
|
||||
:label,
|
||||
:description,
|
||||
:image,
|
||||
:image_upload_id,
|
||||
|
|
|
@ -30,10 +30,10 @@ class CustomWizard::Wizard
|
|||
:action_ids,
|
||||
:user,
|
||||
:guest_id,
|
||||
:submissions,
|
||||
:template
|
||||
|
||||
attr_reader :all_step_ids
|
||||
attr_writer :submissions
|
||||
|
||||
GUEST_ID_PREFIX ||= "guest"
|
||||
GUEST_GROUP_ID = -1
|
||||
|
|
134
plugin.rb
134
plugin.rb
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
# name: discourse-custom-wizard
|
||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||
# version: 2.8.12
|
||||
# version: 2.8.13
|
||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
|
||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||
# contact_emails: development@pavilion.tech
|
||||
|
@ -36,73 +36,71 @@ if respond_to?(:register_svg_icon)
|
|||
end
|
||||
|
||||
after_initialize do
|
||||
%w[
|
||||
../lib/custom_wizard/engine.rb
|
||||
../config/routes.rb
|
||||
../app/controllers/custom_wizard/admin/admin.rb
|
||||
../app/controllers/custom_wizard/admin/subscription.rb
|
||||
../app/controllers/custom_wizard/admin/wizard.rb
|
||||
../app/controllers/custom_wizard/admin/submissions.rb
|
||||
../app/controllers/custom_wizard/admin/api.rb
|
||||
../app/controllers/custom_wizard/admin/logs.rb
|
||||
../app/controllers/custom_wizard/admin/manager.rb
|
||||
../app/controllers/custom_wizard/admin/custom_fields.rb
|
||||
../app/controllers/custom_wizard/wizard_client.rb
|
||||
../app/controllers/custom_wizard/wizard.rb
|
||||
../app/controllers/custom_wizard/steps.rb
|
||||
../app/controllers/custom_wizard/realtime_validations.rb
|
||||
../app/jobs/regular/refresh_api_access_token.rb
|
||||
../app/jobs/regular/set_after_time_wizard.rb
|
||||
../lib/custom_wizard/validators/template.rb
|
||||
../lib/custom_wizard/validators/update.rb
|
||||
../lib/custom_wizard/action_result.rb
|
||||
../lib/custom_wizard/action.rb
|
||||
../lib/custom_wizard/builder.rb
|
||||
../lib/custom_wizard/cache.rb
|
||||
../lib/custom_wizard/custom_field.rb
|
||||
../lib/custom_wizard/field.rb
|
||||
../lib/custom_wizard/realtime_validation.rb
|
||||
../lib/custom_wizard/realtime_validations/result.rb
|
||||
../lib/custom_wizard/realtime_validations/similar_topics.rb
|
||||
../lib/custom_wizard/mapper.rb
|
||||
../lib/custom_wizard/log.rb
|
||||
../lib/custom_wizard/step_updater.rb
|
||||
../lib/custom_wizard/step.rb
|
||||
../lib/custom_wizard/submission.rb
|
||||
../lib/custom_wizard/subscription.rb
|
||||
../lib/custom_wizard/template.rb
|
||||
../lib/custom_wizard/wizard.rb
|
||||
../lib/custom_wizard/user_history.rb
|
||||
../lib/custom_wizard/api/api.rb
|
||||
../lib/custom_wizard/api/authorization.rb
|
||||
../lib/custom_wizard/api/endpoint.rb
|
||||
../lib/custom_wizard/api/log_entry.rb
|
||||
../lib/custom_wizard/liquid_extensions/first_non_empty.rb
|
||||
../lib/custom_wizard/exceptions/exceptions.rb
|
||||
../lib/discourse_plugin_statistics/plugin.rb
|
||||
../app/serializers/custom_wizard/api/authorization_serializer.rb
|
||||
../app/serializers/custom_wizard/api/basic_endpoint_serializer.rb
|
||||
../app/serializers/custom_wizard/api/endpoint_serializer.rb
|
||||
../app/serializers/custom_wizard/api/log_serializer.rb
|
||||
../app/serializers/custom_wizard/api_serializer.rb
|
||||
../app/serializers/custom_wizard/basic_api_serializer.rb
|
||||
../app/serializers/custom_wizard/basic_wizard_serializer.rb
|
||||
../app/serializers/custom_wizard/custom_field_serializer.rb
|
||||
../app/serializers/custom_wizard/wizard_field_serializer.rb
|
||||
../app/serializers/custom_wizard/wizard_step_serializer.rb
|
||||
../app/serializers/custom_wizard/wizard_serializer.rb
|
||||
../app/serializers/custom_wizard/log_serializer.rb
|
||||
../app/serializers/custom_wizard/submission_serializer.rb
|
||||
../app/serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb
|
||||
../lib/custom_wizard/extensions/extra_locales_controller.rb
|
||||
../lib/custom_wizard/extensions/invites_controller.rb
|
||||
../lib/custom_wizard/extensions/users_controller.rb
|
||||
../lib/custom_wizard/extensions/guardian.rb
|
||||
../lib/custom_wizard/extensions/custom_field/preloader.rb
|
||||
../lib/custom_wizard/extensions/custom_field/serializer.rb
|
||||
../lib/custom_wizard/extensions/custom_field/extension.rb
|
||||
../lib/custom_wizard/extensions/discourse_tagging.rb
|
||||
].each { |path| load File.expand_path(path, __FILE__) }
|
||||
require_relative "lib/custom_wizard/engine.rb"
|
||||
require_relative "config/routes.rb"
|
||||
require_relative "app/controllers/custom_wizard/admin/admin.rb"
|
||||
require_relative "app/controllers/custom_wizard/admin/subscription.rb"
|
||||
require_relative "app/controllers/custom_wizard/admin/wizard.rb"
|
||||
require_relative "app/controllers/custom_wizard/admin/submissions.rb"
|
||||
require_relative "app/controllers/custom_wizard/admin/api.rb"
|
||||
require_relative "app/controllers/custom_wizard/admin/logs.rb"
|
||||
require_relative "app/controllers/custom_wizard/admin/manager.rb"
|
||||
require_relative "app/controllers/custom_wizard/admin/custom_fields.rb"
|
||||
require_relative "app/controllers/custom_wizard/wizard_client.rb"
|
||||
require_relative "app/controllers/custom_wizard/wizard.rb"
|
||||
require_relative "app/controllers/custom_wizard/steps.rb"
|
||||
require_relative "app/controllers/custom_wizard/realtime_validations.rb"
|
||||
require_relative "app/jobs/regular/refresh_api_access_token.rb"
|
||||
require_relative "app/jobs/regular/set_after_time_wizard.rb"
|
||||
require_relative "lib/custom_wizard/validators/template.rb"
|
||||
require_relative "lib/custom_wizard/validators/update.rb"
|
||||
require_relative "lib/custom_wizard/action_result.rb"
|
||||
require_relative "lib/custom_wizard/action.rb"
|
||||
require_relative "lib/custom_wizard/builder.rb"
|
||||
require_relative "lib/custom_wizard/cache.rb"
|
||||
require_relative "lib/custom_wizard/custom_field.rb"
|
||||
require_relative "lib/custom_wizard/field.rb"
|
||||
require_relative "lib/custom_wizard/realtime_validation.rb"
|
||||
require_relative "lib/custom_wizard/realtime_validations/result.rb"
|
||||
require_relative "lib/custom_wizard/realtime_validations/similar_topics.rb"
|
||||
require_relative "lib/custom_wizard/mapper.rb"
|
||||
require_relative "lib/custom_wizard/log.rb"
|
||||
require_relative "lib/custom_wizard/step_updater.rb"
|
||||
require_relative "lib/custom_wizard/step.rb"
|
||||
require_relative "lib/custom_wizard/submission.rb"
|
||||
require_relative "lib/custom_wizard/subscription.rb"
|
||||
require_relative "lib/custom_wizard/template.rb"
|
||||
require_relative "lib/custom_wizard/wizard.rb"
|
||||
require_relative "lib/custom_wizard/user_history.rb"
|
||||
require_relative "lib/custom_wizard/api/api.rb"
|
||||
require_relative "lib/custom_wizard/api/authorization.rb"
|
||||
require_relative "lib/custom_wizard/api/endpoint.rb"
|
||||
require_relative "lib/custom_wizard/api/log_entry.rb"
|
||||
require_relative "lib/custom_wizard/liquid_extensions/first_non_empty.rb"
|
||||
require_relative "lib/custom_wizard/exceptions/exceptions.rb"
|
||||
require_relative "lib/discourse_plugin_statistics/plugin.rb"
|
||||
require_relative "app/serializers/custom_wizard/api/authorization_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/api/basic_endpoint_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/api/endpoint_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/api/log_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/api_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/basic_api_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/basic_wizard_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/custom_field_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/wizard_field_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/wizard_step_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/wizard_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/log_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/submission_serializer.rb"
|
||||
require_relative "app/serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb"
|
||||
require_relative "lib/custom_wizard/extensions/extra_locales_controller.rb"
|
||||
require_relative "lib/custom_wizard/extensions/invites_controller.rb"
|
||||
require_relative "lib/custom_wizard/extensions/users_controller.rb"
|
||||
require_relative "lib/custom_wizard/extensions/guardian.rb"
|
||||
require_relative "lib/custom_wizard/extensions/custom_field/preloader.rb"
|
||||
require_relative "lib/custom_wizard/extensions/custom_field/serializer.rb"
|
||||
require_relative "lib/custom_wizard/extensions/custom_field/extension.rb"
|
||||
require_relative "lib/custom_wizard/extensions/discourse_tagging.rb"
|
||||
|
||||
Liquid::Template.error_mode = :strict
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ describe CustomWizard::AdminWizardController do
|
|||
CustomWizard::Template.save(template, skip_jobs: true)
|
||||
template_2 = template.dup
|
||||
template_2["id"] = "super_mega_fun_wizard_2"
|
||||
template_2["permitted"] = template_2["permitted"]
|
||||
CustomWizard::Template.save(template_2, skip_jobs: true)
|
||||
|
||||
template_3 = template.dup
|
||||
|
|
Laden …
In neuem Issue referenzieren