Skip to content

Commit

Permalink
Fix 3.5.4 (#704)
Browse files Browse the repository at this point in the history
* rb-error style

* Update trusted-urls.json

* fix: desensitized for stats

* fix: pageSize

* fix: 多值字段公式中未转为文本

* v3.5.4

* trigger MAX_TRIGGER_DEPTH=256

---------

Co-authored-by: devezhao <[email protected]>
  • Loading branch information
getrebuild and devezhao authored Jan 2, 2024
1 parent 8649f81 commit eb157ee
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion @rbv
Submodule @rbv updated from d3707a to 9c6d46
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>3.5.3</version>
<version>3.5.4</version>
<name>rebuild</name>
<description>Building your business-systems freely!</description>
<url>https://getrebuild.com/</url>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rebuild/core/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public class Application implements ApplicationListener<ApplicationStartedEvent>
/**
* Rebuild Version
*/
public static final String VER = "3.5.3";
public static final String VER = "3.5.4";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 3050308;
public static final int BUILD = 3050409;

static {
// Driver for DB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class FieldAggregation extends TriggerAction {
* @see ConfigurationItem#TriggerMaxDepth
*/
public static final int MAX_TRIGGER_DEPTH = ObjectUtils.toInt(
BootEnvironmentPostProcessor.getProperty(ConfigurationItem.TriggerMaxDepth.name(), "128"));
BootEnvironmentPostProcessor.getProperty(ConfigurationItem.TriggerMaxDepth.name(), "256"));

// 此触发器可能产生连锁反应
// 如触发器 A 调用 B,而 B 又调用了 C ... 以此类推。此处记录其深度
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,22 +436,31 @@ else if ("FORMULA".equalsIgnoreCase(updateMode)) {

Object value = useSourceData.getObjectValue(fieldName);

// fix: 3.5.4
Field varField = MetadataHelper.getLastJoinField(sourceEntity, fieldName);
EasyField easyVarField = varField == null ? null : EasyMetaFactory.valueOf(varField);
boolean isMultiField = easyVarField != null && (easyVarField.getDisplayType() == DisplayType.MULTISELECT
|| easyVarField.getDisplayType() == DisplayType.TAG || easyVarField.getDisplayType() == DisplayType.N2NREFERENCE);

if (value instanceof Date) {
value = CalendarUtils.getUTCDateTimeFormat().format(value);
} else if (value == null) {
// 数字字段置 `0`
Field isNumberField = MetadataHelper.getLastJoinField(sourceEntity, fieldName);
// N2N 保持 `NULL`
Field isN2NField = sourceEntity.containsField(fieldName) ? sourceEntity.getField(fieldName) : null;
if (isNumberField != null
&& (isNumberField.getType() == FieldType.LONG || isNumberField.getType() == FieldType.DECIMAL)) {
// 数字字段置 `0`
if (varField != null
&& (varField.getType() == FieldType.LONG || varField.getType() == FieldType.DECIMAL)) {
value = 0;
} else if (fieldVarsN2NPath.contains(fieldName)
|| (isN2NField != null && isN2NField.getType() == FieldType.REFERENCE_LIST)) {
// Keep NULL
} else {
value = StringUtils.EMPTY;
}
} else if (isMultiField) {
// force `TEXT`
EasyField fakeTextField = EasyMetaFactory.valueOf(MetadataHelper.getField("User", "fullName"));
value = easyVarField.convertCompatibleValue(value, fakeTextField);
} else if (value instanceof ID || forceUseQuote) {
value = value.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.rebuild.core.Application;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.metadata.easymeta.EasyField;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.privileges.UserFilters;
import com.rebuild.core.privileges.UserService;
Expand Down Expand Up @@ -114,13 +115,20 @@ public JSON getJSONResult() {
label = String.format("%s (%s)", Language.L(field), FormatCalc.valueOf(calc).getLabel());
}

EasyField easyField = EasyMetaFactory.valueOf(field);

Object value = count[i];
if (ChartsHelper.isZero(value)) {
value = ChartsHelper.VALUE_ZERO;
} else if (field.getType() == FieldType.LONG) {
value = ObjectUtils.toLong(value);
} else {
value = EasyMetaFactory.valueOf(field).wrapValue(value);
value = easyField.wrapValue(value);
}

// fix: 3.5.4
if (FieldValueHelper.isUseDesensitized(easyField, this.user)) {
value = FieldValueHelper.desensitized(easyField, value);
}

stats.add(JSONUtils.toJSONObject(new String[] { "label", "value" }, new Object[] {label,value} ));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ private void doParseIfNeed() {

int pageNo = NumberUtils.toInt(queryExpr.getString("pageNo"), 1);
int pageSize = NumberUtils.toInt(queryExpr.getString("pageSize"), 40);
pageNo = Math.max(pageNo, 1);
pageSize = Math.max(Math.min(pageSize, 1000), 1);
this.limit = new int[] { pageSize, pageNo * pageSize - pageSize };

this.reload = limit[1] == 0;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/trusted-urls.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
".baidu.com",
".google.com",
"qq.com"
]
2 changes: 1 addition & 1 deletion src/main/resources/web/assets/css/rb-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -23229,7 +23229,7 @@ div.table-responsive > div.dataTables_wrapper > div.row > div[class^='col-']:las

/* EXT */

.rb-error .error-container {
.rb-error.v35 .error-container {
background: #fff url(../img/browser-bar.png) 0 0 no-repeat;
max-width: 888px;
margin: 60px auto;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/web/common/url-safe.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<div class="error-container mt-0">
<div class="safe-tips">
<h3>[[${bundle.L('即将跳转到外部网站')}]]</h3>
<p><i class="mdi mdi-shield-alert-outline"></i> [[${bundle.L('请注意你的账户安全')}]]</p>
<p class="text-warning"><i class="mdi mdi-shield-alert-outline"></i> [[${bundle.L('请注意你的账户安全')}]]</p>
<div class="url">
<span class="icon"><i class="zmdi zmdi-link"></i></span>
<span class="text" th:utext="${outerUrl}"></span>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/web/error/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</style>
</head>
<body class="rb-splash-screen">
<div class="rb-wrapper rb-error">
<div class="rb-wrapper rb-error v35">
<div class="rb-content m-0">
<div class="main-content container">
<div class="error-container">
Expand Down

0 comments on commit eb157ee

Please sign in to comment.