mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 04:25:03 +02:00
qfix: do not allow to disable contacts plugin (#10025)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
@@ -34,9 +34,7 @@ export async function changeConfiguration (
|
||||
const config = await connection.findAll(core.class.PluginConfiguration, {})
|
||||
if (cmd.list === true) {
|
||||
for (const c of config) {
|
||||
if (c.label !== undefined) {
|
||||
console.log(toLen(c.pluginId, '-', 20), c.enabled)
|
||||
}
|
||||
console.log(toLen(c.pluginId, '-', 20), c.enabled, c.hidden === true ? '(hidden)' : '')
|
||||
}
|
||||
}
|
||||
const enable = (cmd.enable ?? '').trim().split(',')
|
||||
|
||||
+18
-3
@@ -190,6 +190,7 @@ export default function buildModel (): Builder {
|
||||
label: contact.string.ConfigLabel,
|
||||
description: contact.string.ConfigDescription,
|
||||
enabled: true,
|
||||
system: true,
|
||||
beta: false,
|
||||
icon: contact.icon.ContactApplication,
|
||||
classFilter: defaultFilter
|
||||
@@ -354,10 +355,11 @@ export default function buildModel (): Builder {
|
||||
requestModel,
|
||||
requestId,
|
||||
{
|
||||
// label: request.string.ConfigLabel,
|
||||
label: setting.string.Configure,
|
||||
// description: request.string.ConfigDescription,
|
||||
enabled: false,
|
||||
beta: false,
|
||||
hidden: true,
|
||||
classFilter: defaultFilter
|
||||
}
|
||||
],
|
||||
@@ -421,8 +423,10 @@ export default function buildModel (): Builder {
|
||||
questionsModel,
|
||||
questionsId,
|
||||
{
|
||||
label: setting.string.Configure,
|
||||
enabled: false,
|
||||
beta: false,
|
||||
hidden: true,
|
||||
classFilter: defaultFilter
|
||||
}
|
||||
],
|
||||
@@ -480,7 +484,16 @@ export default function buildModel (): Builder {
|
||||
[emojiModel, emojiId],
|
||||
[communicationModel, communicationId],
|
||||
[mailModel, mailId],
|
||||
[billingModel, billingId, { beta: false, hidden: true, enabled: true }],
|
||||
[
|
||||
billingModel,
|
||||
billingId,
|
||||
{
|
||||
label: setting.string.Configure,
|
||||
beta: false,
|
||||
hidden: true,
|
||||
enabled: true
|
||||
}
|
||||
],
|
||||
[hulyMailModel, hulyMailId],
|
||||
[
|
||||
aiAssistantModel,
|
||||
@@ -543,7 +556,9 @@ export default function buildModel (): Builder {
|
||||
pluginId: id,
|
||||
transactions: txes.map((it) => it._id),
|
||||
...config,
|
||||
enabled: config?.label === undefined || ((config?.enabled ?? true) && !(config.hidden ?? false)),
|
||||
label: config?.label ?? setting.string.Configure,
|
||||
hidden: config !== undefined ? config.hidden : true,
|
||||
enabled: (config?.enabled ?? true) && !(config?.hidden ?? false),
|
||||
beta: config?.beta ?? false
|
||||
},
|
||||
('plugin-configuration-' + id) as Ref<PluginConfiguration>
|
||||
|
||||
@@ -178,6 +178,7 @@ describe('client', () => {
|
||||
|
||||
const pluginData1: Data<PluginConfiguration> = {
|
||||
pluginId: 'testPlugin1' as Plugin,
|
||||
label: 'Test Plugin 1' as IntlString,
|
||||
transactions: [],
|
||||
beta: true,
|
||||
enabled: true
|
||||
@@ -198,6 +199,7 @@ describe('client', () => {
|
||||
|
||||
const pluginData2 = {
|
||||
pluginId: 'testPlugin2' as Plugin,
|
||||
label: 'Test Plugin 2' as IntlString,
|
||||
transactions: [],
|
||||
beta: true,
|
||||
enabled: true
|
||||
@@ -219,6 +221,7 @@ describe('client', () => {
|
||||
|
||||
const pluginData3 = {
|
||||
pluginId: 'testPlugin3' as Plugin,
|
||||
label: 'Test Plugin 3' as IntlString,
|
||||
transactions: [txCreateDoc1._id],
|
||||
beta: true,
|
||||
enabled: true
|
||||
|
||||
@@ -275,11 +275,14 @@ export interface PluginConfiguration extends Doc {
|
||||
pluginId: Plugin
|
||||
transactions: Ref<Doc>[]
|
||||
|
||||
label?: IntlString
|
||||
label: IntlString
|
||||
icon?: Asset
|
||||
description?: IntlString
|
||||
enabled: boolean
|
||||
|
||||
// If set will not allow to disable this configuration
|
||||
system?: true
|
||||
|
||||
// If set will not be shown in configuration UI or enabled
|
||||
hidden?: boolean
|
||||
|
||||
|
||||
@@ -819,7 +819,9 @@ export function fillConfiguration (systemTx: Tx[], configs: Map<Ref<PluginConfig
|
||||
if (ut.objectClass === core.class.PluginConfiguration) {
|
||||
const c = configs.get(ut.objectId as Ref<PluginConfiguration>)
|
||||
if (c !== undefined) {
|
||||
TxProcessor.updateDoc2Doc(c, ut)
|
||||
if (c.system !== true || ut.modifiedBy === core.account.ConfigUser) {
|
||||
TxProcessor.updateDoc2Doc(c, ut)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ export class ConfigurationManager {
|
||||
) {}
|
||||
|
||||
has (plugin: Plugin): boolean {
|
||||
return this.configuration.get(plugin)?.enabled !== false
|
||||
const configuration = this.configuration.get(plugin)
|
||||
return configuration !== undefined && configuration.enabled
|
||||
}
|
||||
|
||||
hasResource<T>(resource?: Resource<T> | null): boolean | undefined {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<Scroller align={'center'} padding={'var(--spacing-3)'} bottomPadding={'var(--spacing-3)'}>
|
||||
<div class="flex-row-center flex-wrap gap-around-4">
|
||||
{#each $pluginConfigurationStore.list as config}
|
||||
{#if config.label && !(config.hidden ?? false)}
|
||||
{#if config.hidden !== true && config.system !== true}
|
||||
<div class="cardBox flex-col clear-mins" class:enabled={config.enabled ?? true}>
|
||||
<div class="flex-row-center">
|
||||
<span class="mr-2">
|
||||
|
||||
Reference in New Issue
Block a user