mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix(MessageConfigForm): add description for user selection and improve locale support (#6424)
This commit is contained in:
parent
e00b294cec
commit
69a44fff1a
@ -9,7 +9,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { SchemaComponent, css } from '@nocobase/client';
|
||||
import { useLocalTranslation } from '../../locale';
|
||||
import { useLocalTranslation, NAMESPACE } from '../../locale';
|
||||
import { UsersSelect } from './UsersSelect';
|
||||
import { UsersAddition } from './UsersAddition';
|
||||
import { tval } from '@nocobase/utils/client';
|
||||
@ -26,6 +26,10 @@ export const MessageConfigForm = ({ variableOptions }) => {
|
||||
receivers: {
|
||||
type: 'array',
|
||||
title: `{{t("Receivers")}}`,
|
||||
description: tval(
|
||||
'When select receivers from node result, only support ID of user (or IDs array of users). Others will not match any user.',
|
||||
{ ns: NAMESPACE },
|
||||
),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'ArrayItems',
|
||||
items: {
|
||||
|
@ -24,5 +24,6 @@
|
||||
"Mark as read": "Mark as read",
|
||||
"Support two types of links: internal links and external links. If using an internal link, the link starts with\"/\", for example, \"/m\". If using an external link, the link starts with \"http\", for example, \"https://example.com\".": "Support two types of links: internal links and external links. If using an internal link, the link starts with \"/\", for example, \"/m\". If using an external link, the link starts with \"http\", for example, \"https://example.com\".",
|
||||
"Details page for mobile": "Details page for mobile",
|
||||
"The message page has already been created.": "The message page has already been created."
|
||||
"The message page has already been created.": "The message page has already been created.",
|
||||
"When select receivers from node result, only support ID of user (or IDs array of users). Others will not match any user.": "When select receivers from node result, only support ID of user (or IDs array of users). Others will not match any user."
|
||||
}
|
||||
|
@ -24,5 +24,6 @@
|
||||
"Mark as read": "标记为已读",
|
||||
"Support two types of links: internal links and external links. If using an internal link, the link starts with\"/\", for example, \"/m\". If using an external link, the link starts with \"http\", for example, \"https://example.com\".": "支持两种链接类型:内部链接和外部链接。如果使用内部链接,链接以“/”开头,例如“/m”。如果使用外部链接,链接以“http”开头,例如“https://example.com”。",
|
||||
"Details page for mobile": "移动端详情页",
|
||||
"The message page has already been created.": "站内信页面已创建。"
|
||||
"The message page has already been created.": "站内信页面已创建。",
|
||||
"When select receivers from node result, only support ID of user (or IDs array of users). Others will not match any user.": "从节点结果中选择接收者时,仅支持用户ID(或用户ID数组)。其他将不匹配任何用户。"
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
import { Repository } from '@nocobase/database';
|
||||
import { isValidFilter } from '@nocobase/utils';
|
||||
export async function parseUserSelectionConf(
|
||||
userSelectionConfig: Array<Record<any, any> | string>,
|
||||
UserRepo: Repository,
|
||||
@ -16,6 +17,9 @@ export async function parseUserSelectionConf(
|
||||
const users = new Set<string>();
|
||||
for (const item of SelectionConfigs) {
|
||||
if (typeof item === 'object') {
|
||||
if (!isValidFilter(item.filter)) {
|
||||
continue;
|
||||
}
|
||||
const result = await UserRepo.find({
|
||||
...item,
|
||||
fields: ['id'],
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
import { Handlebars } from '@nocobase/utils';
|
||||
import { isPlainObject } from '@nocobase/utils';
|
||||
|
||||
function deepCompile(template: unknown, data: Record<string, any>): unknown {
|
||||
if (typeof template === 'string') {
|
||||
@ -15,7 +16,7 @@ function deepCompile(template: unknown, data: Record<string, any>): unknown {
|
||||
return c(data);
|
||||
} else if (Array.isArray(template)) {
|
||||
return template.map((item) => deepCompile(item, data));
|
||||
} else if (typeof template === 'object') {
|
||||
} else if (isPlainObject(template)) {
|
||||
const result = Object.keys(template).reduce((object, key) => {
|
||||
const value = deepCompile(template[key], data);
|
||||
return Object.assign(object, { [key]: value });
|
||||
|
Loading…
x
Reference in New Issue
Block a user