prettier
Dieser Commit ist enthalten in:
Ursprung
bd5edaffe9
Commit
8cbc8745b9
3 geänderte Dateien mit 33 neuen und 17 gelöschten Zeilen
|
@ -10,7 +10,9 @@ import wizardSchema, {
|
||||||
|
|
||||||
const generateContent = function (kategory, subscription) {
|
const generateContent = function (kategory, subscription) {
|
||||||
let unsubscribedCustomFields = requiringAdditionalSubscription(
|
let unsubscribedCustomFields = requiringAdditionalSubscription(
|
||||||
subscription, "custom_fields", kategory
|
subscription,
|
||||||
|
"custom_fields",
|
||||||
|
kategory
|
||||||
);
|
);
|
||||||
return wizardSchema.custom_field[kategory].reduce((result, item) => {
|
return wizardSchema.custom_field[kategory].reduce((result, item) => {
|
||||||
let disabled = unsubscribedCustomFields.includes(item);
|
let disabled = unsubscribedCustomFields.includes(item);
|
||||||
|
|
|
@ -99,7 +99,11 @@ export default Component.extend(UndoChanges, {
|
||||||
|
|
||||||
@discourseComputed("subscription")
|
@discourseComputed("subscription")
|
||||||
actionTypes(subscription) {
|
actionTypes(subscription) {
|
||||||
let unsubscribedActions = requiringAdditionalSubscription (subscription, "actions", "");
|
let unsubscribedActions = requiringAdditionalSubscription(
|
||||||
|
subscription,
|
||||||
|
"actions",
|
||||||
|
""
|
||||||
|
);
|
||||||
return Object.keys(wizardSchema.action.types).reduce((result, type) => {
|
return Object.keys(wizardSchema.action.types).reduce((result, type) => {
|
||||||
let disabled = unsubscribedActions.includes(type);
|
let disabled = unsubscribedActions.includes(type);
|
||||||
result.push({
|
result.push({
|
||||||
|
|
|
@ -207,17 +207,17 @@ const subscription_levels = {
|
||||||
actions: ["send_message", "add_to_group", "watch_categories"],
|
actions: ["send_message", "add_to_group", "watch_categories"],
|
||||||
custom_fields: {
|
custom_fields: {
|
||||||
klass: [],
|
klass: [],
|
||||||
type: ["json"]
|
type: ["json"],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
business: {
|
business: {
|
||||||
actions: ["create_category", "create_group", "send_to_api"],
|
actions: ["create_category", "create_group", "send_to_api"],
|
||||||
custom_fields: {
|
custom_fields: {
|
||||||
klass: ["group", "category"],
|
klass: ["group", "category"],
|
||||||
type: []
|
type: [],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const wizardSchema = {
|
const wizardSchema = {
|
||||||
|
@ -226,11 +226,13 @@ const wizardSchema = {
|
||||||
field,
|
field,
|
||||||
custom_field,
|
custom_field,
|
||||||
action,
|
action,
|
||||||
subscription_levels
|
subscription_levels,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function requiringAdditionalSubscription(
|
export function requiringAdditionalSubscription(
|
||||||
currentSubscription, category, subCategory
|
currentSubscription,
|
||||||
|
category,
|
||||||
|
subCategory
|
||||||
) {
|
) {
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case "actions":
|
case "actions":
|
||||||
|
@ -258,7 +260,7 @@ export function requiringAdditionalSubscription(
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export function subscriptionLevel(type, category, subCategory) {
|
export function subscriptionLevel(type, category, subCategory) {
|
||||||
switch (category) {
|
switch (category) {
|
||||||
|
@ -273,10 +275,18 @@ export function subscriptionLevel(type, category, subCategory) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "custom_fields":
|
case "custom_fields":
|
||||||
if (subscription_levels["business"].custom_fields[subCategory].includes(type)) {
|
if (
|
||||||
|
subscription_levels["business"].custom_fields[subCategory].includes(
|
||||||
|
type
|
||||||
|
)
|
||||||
|
) {
|
||||||
return "business";
|
return "business";
|
||||||
} else {
|
} else {
|
||||||
if (subscription_levels["standard"].custom_fields[subCategory].includes(type)) {
|
if (
|
||||||
|
subscription_levels["standard"].custom_fields[subCategory].includes(
|
||||||
|
type
|
||||||
|
)
|
||||||
|
) {
|
||||||
return "standard";
|
return "standard";
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
@ -285,15 +295,15 @@ export function subscriptionLevel(type, category, subCategory) {
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export function buildFieldTypes(types) {
|
export function buildFieldTypes(types) {
|
||||||
wizardSchema.field.types = types;
|
wizardSchema.field.types = types;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function buildFieldValidations(validations) {
|
export function buildFieldValidations(validations) {
|
||||||
wizardSchema.field.validations = validations;
|
wizardSchema.field.validations = validations;
|
||||||
};
|
}
|
||||||
|
|
||||||
const siteSettings = getOwner(this).lookup("site-settings:main");
|
const siteSettings = getOwner(this).lookup("site-settings:main");
|
||||||
if (siteSettings.wizard_apis_enabled) {
|
if (siteSettings.wizard_apis_enabled) {
|
||||||
|
@ -302,7 +312,7 @@ if (siteSettings.wizard_apis_enabled) {
|
||||||
api_endpoint: null,
|
api_endpoint: null,
|
||||||
api_body: null,
|
api_body: null,
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
export function setWizardDefaults(obj, itemType) {
|
export function setWizardDefaults(obj, itemType) {
|
||||||
const objSchema = wizardSchema[itemType];
|
const objSchema = wizardSchema[itemType];
|
||||||
|
@ -328,6 +338,6 @@ export function setWizardDefaults(obj, itemType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default wizardSchema;
|
export default wizardSchema;
|
||||||
|
|
Laden …
In neuem Issue referenzieren