Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 01:10:28 +01:00
Apply rubocop
Dieser Commit ist enthalten in:
Ursprung
23c4b45195
Commit
7c9a0ef862
15 geänderte Dateien mit 23 neuen und 21 gelöschten Zeilen
|
@ -39,10 +39,10 @@ class CustomWizard::AdminProController < CustomWizard::AdminController
|
|||
render json: failed_json
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
|
||||
def pro
|
||||
@pro ||= CustomWizard::Pro.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class CustomWizard::UpdateProSubscription < ::Jobs::Scheduled
|
||||
every 1.hour
|
||||
|
||||
def execute(args={})
|
||||
def execute(args = {})
|
||||
CustomWizard::Pro.update_subscription
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -752,7 +752,7 @@ class CustomWizard::Action
|
|||
|
||||
CustomWizard::Log.create(log)
|
||||
end
|
||||
|
||||
|
||||
def pro_actions
|
||||
%w[send_message watch_categories send_to_api create_group create_category]
|
||||
end
|
||||
|
|
|
@ -183,4 +183,4 @@ class CustomWizard::Pro
|
|||
PluginStore.remove(self.class.namespace, authentication_db_key)
|
||||
get_authentication
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::ProAuthentication
|
||||
include ActiveModel::Serialization
|
||||
|
||||
|
@ -21,7 +22,7 @@ class CustomWizard::ProAuthentication
|
|||
end
|
||||
|
||||
def generate_keys(user_id, request_id)
|
||||
rsa = OpenSSL::PKey::RSA.generate(2048)
|
||||
rsa = OpenSSL::PKey::RSA.generate(2048)
|
||||
nonce = SecureRandom.hex(32)
|
||||
set_keys(request_id, user_id, rsa, nonce)
|
||||
|
||||
|
@ -91,4 +92,4 @@ class CustomWizard::ProAuthentication
|
|||
PluginStore.set(CustomWizard::Pro.namespace, client_id_db_key, client_id)
|
||||
client_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
class CustomWizard::ProSubscription
|
||||
include ActiveModel::Serialization
|
||||
|
||||
|
@ -18,4 +19,4 @@ class CustomWizard::ProSubscription
|
|||
def active?
|
||||
types.include?(type) && updated_at.to_datetime > (Time.zone.now - 2.hours).to_datetime
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,4 +8,4 @@ class CustomWizard::ProAuthenticationSerializer < ApplicationSerializer
|
|||
def active
|
||||
object.active?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,4 +7,4 @@ class CustomWizard::ProSubscriptionSerializer < ApplicationSerializer
|
|||
def active
|
||||
object.active?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,4 +3,4 @@ class CustomWizard::ProSerializer < ApplicationSerializer
|
|||
attributes :server
|
||||
has_one :authentication, serializer: CustomWizard::ProAuthenticationSerializer, embed: :objects
|
||||
has_one :subscription, serializer: CustomWizard::ProSubscriptionSerializer, embed: :objects
|
||||
end
|
||||
end
|
||||
|
|
|
@ -178,7 +178,7 @@ describe CustomWizard::Action do
|
|||
before do
|
||||
enable_pro
|
||||
end
|
||||
|
||||
|
||||
it '#send_message' do
|
||||
wizard_template['actions'] << send_message
|
||||
update_template(wizard_template)
|
||||
|
|
|
@ -251,7 +251,7 @@ describe CustomWizard::Builder do
|
|||
end
|
||||
end
|
||||
|
||||
context "with condition" do
|
||||
context "with condition" do
|
||||
before do
|
||||
enable_pro
|
||||
@template[:steps][0][:condition] = user_condition_json['condition']
|
||||
|
|
|
@ -192,7 +192,7 @@ describe CustomWizard::CustomField do
|
|||
).exists?
|
||||
).to eq(false)
|
||||
end
|
||||
|
||||
|
||||
it "does not save pro field types without a pro subscription" do
|
||||
pro_field_json = custom_field_pro_json['custom_fields'].first
|
||||
custom_field = CustomWizard::CustomField.new(nil, pro_field_json)
|
||||
|
|
|
@ -122,4 +122,4 @@ describe CustomWizard::Pro do
|
|||
expect(@pro.authorized?).to eq(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ describe CustomWizard::AdminProController do
|
|||
it "#destroy_authentication" do
|
||||
request_id = SecureRandom.hex(32)
|
||||
payload = generate_payload(request_id, admin_user.id)
|
||||
@pro.authentication_response(request_id, payload)
|
||||
@pro.authentication_response(request_id, payload)
|
||||
|
||||
delete "/admin/wizards/pro/authorize.json"
|
||||
|
||||
|
@ -68,4 +68,4 @@ describe CustomWizard::AdminProController do
|
|||
expect(CustomWizard::Pro.subscribed?).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,7 +78,7 @@ describe CustomWizard::StepsController do
|
|||
|
||||
put '/w/super-mega-fun-wizard/steps/step_1.json'
|
||||
put '/w/super-mega-fun-wizard/steps/step_2.json'
|
||||
put '/w/super-mega-fun-wizard/steps/step_3.json'
|
||||
put '/w/super-mega-fun-wizard/steps/step_3.json'
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.parsed_body['redirect_on_complete']).to eq("https://google.com")
|
||||
end
|
||||
|
@ -95,7 +95,7 @@ describe CustomWizard::StepsController do
|
|||
}
|
||||
}
|
||||
put '/w/super-mega-fun-wizard/steps/step_2.json'
|
||||
put '/w/super-mega-fun-wizard/steps/step_3.json'
|
||||
put '/w/super-mega-fun-wizard/steps/step_3.json'
|
||||
|
||||
wizard_id = response.parsed_body['wizard']['id']
|
||||
wizard = CustomWizard::Wizard.create(wizard_id, user)
|
||||
|
|
Laden …
In neuem Issue referenzieren