Merge branch 'main' into admin-acceptance-tests
Dieser Commit ist enthalten in:
Commit
9ff9844420
9 geänderte Dateien mit 37 neuen und 4 gelöschten Zeilen
2
.github/workflows/discourse-plugin.yml
gevendort
2
.github/workflows/discourse-plugin.yml
gevendort
|
@ -5,6 +5,8 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
|
|
@ -35,6 +35,7 @@ function inputTypesContent(options = {}) {
|
||||||
const connectors = {
|
const connectors = {
|
||||||
pair: [
|
pair: [
|
||||||
"equal",
|
"equal",
|
||||||
|
"not_equal",
|
||||||
"greater",
|
"greater",
|
||||||
"less",
|
"less",
|
||||||
"greater_or_equal",
|
"greater_or_equal",
|
||||||
|
|
|
@ -324,6 +324,7 @@ en:
|
||||||
then: "then"
|
then: "then"
|
||||||
set: "set"
|
set: "set"
|
||||||
equal: '='
|
equal: '='
|
||||||
|
not_equal: '!='
|
||||||
greater: '>'
|
greater: '>'
|
||||||
less: '<'
|
less: '<'
|
||||||
greater_or_equal: '>='
|
greater_or_equal: '>='
|
||||||
|
|
|
@ -15,13 +15,13 @@ class CustomWizard::Log
|
||||||
@username = attrs['username']
|
@username = attrs['username']
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create(wizard_id, action, username, message)
|
def self.create(wizard_id, action, username, message, date = Time.now)
|
||||||
log_id = SecureRandom.hex(12)
|
log_id = SecureRandom.hex(12)
|
||||||
|
|
||||||
PluginStore.set('custom_wizard_log',
|
PluginStore.set('custom_wizard_log',
|
||||||
log_id.to_s,
|
log_id.to_s,
|
||||||
{
|
{
|
||||||
date: Time.now,
|
date: date,
|
||||||
wizard_id: wizard_id,
|
wizard_id: wizard_id,
|
||||||
action: action,
|
action: action,
|
||||||
username: username,
|
username: username,
|
||||||
|
|
|
@ -30,6 +30,7 @@ class CustomWizard::Mapper
|
||||||
|
|
||||||
OPERATORS = {
|
OPERATORS = {
|
||||||
equal: '==',
|
equal: '==',
|
||||||
|
not_equal: "!=",
|
||||||
greater: '>',
|
greater: '>',
|
||||||
less: '<',
|
less: '<',
|
||||||
greater_or_equal: '>=',
|
greater_or_equal: '>=',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
# name: discourse-custom-wizard
|
# name: discourse-custom-wizard
|
||||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||||
# version: 2.3.2
|
# version: 2.3.4
|
||||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
||||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||||
# contact_emails: development@pavilion.tech
|
# contact_emails: development@pavilion.tech
|
||||||
|
|
|
@ -291,6 +291,19 @@ describe CustomWizard::Mapper do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "handles not equal pairs" do
|
||||||
|
expect(CustomWizard::Mapper.new(
|
||||||
|
inputs: inputs['not_equals_pair'],
|
||||||
|
data: data,
|
||||||
|
user: user1
|
||||||
|
).perform).to eq(true)
|
||||||
|
expect(CustomWizard::Mapper.new(
|
||||||
|
inputs: inputs['not_equals_pair'],
|
||||||
|
data: data,
|
||||||
|
user: user2
|
||||||
|
).perform).to eq(false)
|
||||||
|
end
|
||||||
|
|
||||||
it "handles greater than pairs" do
|
it "handles greater than pairs" do
|
||||||
expect(CustomWizard::Mapper.new(
|
expect(CustomWizard::Mapper.new(
|
||||||
inputs: inputs['greater_than_pair'],
|
inputs: inputs['greater_than_pair'],
|
||||||
|
|
15
spec/fixtures/mapper/inputs.json
gevendort
15
spec/fixtures/mapper/inputs.json
gevendort
|
@ -195,6 +195,21 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"not_equals_pair": [
|
||||||
|
{
|
||||||
|
"type": "validation",
|
||||||
|
"pairs": [
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"key": "trust_level",
|
||||||
|
"key_type": "user_field",
|
||||||
|
"value": "1",
|
||||||
|
"value_type": "text",
|
||||||
|
"connector": "not_equal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"greater_than_pair": [
|
"greater_than_pair": [
|
||||||
{
|
{
|
||||||
"type": "validation",
|
"type": "validation",
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe CustomWizard::LogSerializer do
|
||||||
fab!(:user) { Fabricate(:user) }
|
fab!(:user) { Fabricate(:user) }
|
||||||
|
|
||||||
it 'should return log attributes' do
|
it 'should return log attributes' do
|
||||||
CustomWizard::Log.create('first-test-wizard', 'perform_first_action', 'first_test_user', 'First log message')
|
CustomWizard::Log.create('first-test-wizard', 'perform_first_action', 'first_test_user', 'First log message', 1.day.ago)
|
||||||
CustomWizard::Log.create('second-test-wizard', 'perform_second_action', 'second_test_user', 'Second log message')
|
CustomWizard::Log.create('second-test-wizard', 'perform_second_action', 'second_test_user', 'Second log message')
|
||||||
|
|
||||||
json_array = ActiveModel::ArraySerializer.new(
|
json_array = ActiveModel::ArraySerializer.new(
|
||||||
|
|
Laden …
In neuem Issue referenzieren