♻️ refactor(command): 黑白名单过滤从 AND 改为 OR 逻辑
- 白名单模式:用户在名单 OR 群在名单 → 放行 - 黑名单模式:用户在名单 OR 群在名单 → 拒绝 - 名单为空时表示不限制 - 更新前端提示说明 OR 逻辑的语义
This commit is contained in:
@@ -606,7 +606,10 @@ body {
|
||||
<div class="card-header"><h3>名单开关</h3></div>
|
||||
<div class="card-body">
|
||||
<div class="info-block">
|
||||
开启后,仅名单内的群/用户可触发命令(白名单),或名单内的群/用户不可触发(黑名单)。
|
||||
<strong>白名单模式:</strong>用户在名单 <em>或</em> 群在名单 → 可触发。<br>
|
||||
例如:设置白名单群后,该群全员可用;设置白名单用户后,该用户全域可用。<br>
|
||||
<strong>黑名单模式:</strong>用户在名单 <em>或</em> 群在名单 → 拒绝。<br>
|
||||
名单为空时表示不限制。
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="switch-wrapper">
|
||||
@@ -835,20 +838,21 @@ function updateListModeUI() {
|
||||
const allowUserContainer = document.getElementById('allowedUsersContainer');
|
||||
const denyUserContainer = document.getElementById('deniedUsersContainer');
|
||||
|
||||
// Reset
|
||||
// Reset - all enabled
|
||||
[allowGroups, denyGroups, allowUsers, denyUsers].forEach(el => el.style.opacity = '1');
|
||||
[allowContainer, denyContainer, allowUserContainer, denyUserContainer].forEach(el => el.classList.remove('disabled'));
|
||||
|
||||
if (!enabled) return;
|
||||
|
||||
// OR 逻辑下,两种名单可以同时配置,但只用当前模式的名单
|
||||
if (mode === 'allow') {
|
||||
// 白名单模式:灰掉黑名单
|
||||
// 白名单模式:灰掉黑名单(不生效)
|
||||
denyGroups.style.opacity = '0.4';
|
||||
denyUsers.style.opacity = '0.4';
|
||||
denyContainer.classList.add('disabled');
|
||||
denyUserContainer.classList.add('disabled');
|
||||
} else {
|
||||
// 黑名单模式:灰掉白名单
|
||||
// 黑名单模式:灰掉白名单(不生效)
|
||||
allowGroups.style.opacity = '0.4';
|
||||
allowUsers.style.opacity = '0.4';
|
||||
allowContainer.classList.add('disabled');
|
||||
|
||||
Reference in New Issue
Block a user