fix(admin): translate credits_added notification type
Display credits_added as 积分增加 with a success badge across message filters, list rows and details. Extend rendering regression coverage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f208424a26
commit
1cd19434d1
3 files changed
+10
-5
No files matched your search
@@ -34,6 +34,7 @@ final class MessageTypes {
|
||||
'ban_appeal' => __('禁封申诉', 'aksrt'),
|
||||
'report' => __('举报', 'aksrt'),
|
||||
'withdraw' => __('提现', 'aksrt'),
|
||||
'credits_added' => __('积分增加', 'aksrt'),
|
||||
'ticket_new' => __('新工单', 'aksrt'),
|
||||
'ticket_reply' => __('工单回复', 'aksrt'),
|
||||
'ticket_urge' => __('工单催单', 'aksrt'),
|
||||
@@ -57,7 +58,7 @@ final class MessageTypes {
|
||||
if (in_array($type, ['report', 'ban_appeal', 'asset_balance_decrease', 'asset_points_decrease'], true)) {
|
||||
return 'danger';
|
||||
}
|
||||
if (in_array($type, ['withdraw', 'level_up', 'medal', 'auth_apply_reply', 'download_ready', 'asset_balance_increase', 'asset_points_increase'], true)) {
|
||||
if (in_array($type, ['withdraw', 'level_up', 'medal', 'auth_apply_reply', 'download_ready', 'credits_added', 'asset_balance_increase', 'asset_points_increase'], true)) {
|
||||
return 'success';
|
||||
}
|
||||
if (in_array($type, ['system', 'notice'], true)) {
|
||||
|
||||
@@ -165,19 +165,22 @@ test('role broadcasts require confirmation of the current role and count on the
|
||||
assert.equal(nonce_checked.length, 8);
|
||||
});
|
||||
|
||||
test('asset types use Chinese labels in filters, row badges and details', () => {
|
||||
const { asset_types, filter_form, asset_table } = harness();
|
||||
test('asset and credit types use Chinese labels in filters, row badges and details', () => {
|
||||
const { asset_types, filter_form, asset_table, credits_table } = harness();
|
||||
assert.deepEqual(asset_types, {
|
||||
asset_balance_increase: ['余额增加', 'success'],
|
||||
asset_balance_decrease: ['余额减少', 'danger'],
|
||||
asset_points_increase: ['积分增加', 'success'],
|
||||
asset_points_decrease: ['积分减少', 'danger'],
|
||||
credits_added: ['积分增加', 'success'],
|
||||
});
|
||||
for (const [type, [label]] of Object.entries(asset_types)) {
|
||||
assert.ok(filter_form.includes(`<option value="${type}">${label}</option>`));
|
||||
}
|
||||
assert.match(asset_table, /class="aksrt-msg-badge is-success"[^>]*>余额增加<\/a>/);
|
||||
assert.match(asset_table, /<dt>消息类型<\/dt><dd>余额增加<\/dd>/);
|
||||
assert.match(credits_table, /class="aksrt-msg-badge is-success"[^>]*>积分增加<\/a>/);
|
||||
assert.match(credits_table, /<dt>消息类型<\/dt><dd>积分增加<\/dd>/);
|
||||
});
|
||||
|
||||
test('single row actions cannot accidentally operate on the checked bulk selection', () => {
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace {
|
||||
public function get_var($sql) { return 2; }
|
||||
public function get_results($sql, $format) { return []; }
|
||||
public function get_row($sql, $format) { return ['total' => 2, 'unread' => 1, 'today' => 1, 'recipients' => 2]; }
|
||||
public function get_col($sql) { return ['system', 'asset_balance_increase', 'asset_balance_decrease', 'asset_points_increase', 'asset_points_decrease']; }
|
||||
public function get_col($sql) { return ['system', 'asset_balance_increase', 'asset_balance_decrease', 'asset_points_increase', 'asset_points_decrease', 'credits_added']; }
|
||||
public function query($sql) { $this->queries[] = $sql; return 1; }
|
||||
public function esc_like($text) { return addcslashes($text, '_%\\'); }
|
||||
}
|
||||
@@ -121,7 +121,8 @@ namespace {
|
||||
$out['empty'] = $probe->html('render_message_table', [], $filters, 1, false);
|
||||
$out['cache_calls'] = $GLOBALS['cache_calls'];
|
||||
$out['asset_table'] = $probe->html('render_message_table', [array_merge($row, ['type' => 'asset_balance_increase'])], $filters, 1, false);
|
||||
foreach (['asset_balance_increase', 'asset_balance_decrease', 'asset_points_increase', 'asset_points_decrease'] as $type) {
|
||||
$out['credits_table'] = $probe->html('render_message_table', [array_merge($row, ['type' => 'credits_added'])], $filters, 1, false);
|
||||
foreach (['asset_balance_increase', 'asset_balance_decrease', 'asset_points_increase', 'asset_points_decrease', 'credits_added'] as $type) {
|
||||
$out['asset_types'][$type] = [\AKSRT\Messages\MessageTypes::label($type), \AKSRT\Messages\MessageTypes::tone($type)];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user