进行了一些小优化

This commit is contained in:
2026-08-25 17:02:33 +08:00
parent 4a4009133c
commit 11f1c23fa7
12 changed files with 463 additions and 10 deletions
+8 -1
View File
@@ -32,7 +32,11 @@ function aksrt_get_user_notifications(int $user_id = 0): array {
'status' => 'hold',
]);
if ($pending_comments > 0 && (!class_exists('\AKSRT\Settings\Settings') || \AKSRT\Settings\Settings::notification_enabled('pending_comments'))) {
if (
$pending_comments > 0
&& (!class_exists('\AKSRT\Settings\Settings') || \AKSRT\Settings\Settings::notification_enabled('pending_comments'))
&& (!class_exists('\AKSRT\User\NotificationPreferences') || \AKSRT\User\NotificationPreferences::allows($user_id, 'pending_comments'))
) {
$items[] = [
'type' => 'pending_comments',
'title' => __('评论待审核', 'aksrt'),
@@ -249,6 +253,9 @@ if (!function_exists('aksrt_add_user_notification')) :
function aksrt_add_user_notification(int $user_id, array $payload): void {
if ($user_id <= 0) return;
$type = sanitize_key((string) ($payload['type'] ?? 'notice'));
if (class_exists('\AKSRT\User\NotificationPreferences') && !\AKSRT\User\NotificationPreferences::allows($user_id, $type)) {
return;
}
if (class_exists('\AKSRT\Settings\Settings') && !\AKSRT\Settings\Settings::notification_enabled($type)) {
return;
}