Improve topbar

This commit is contained in:
2026-07-01 13:37:28 +02:00
parent c413491171
commit 0c7f8d001d
2 changed files with 29 additions and 6 deletions

View File

@@ -75,7 +75,17 @@ class XenforoApiService {
}
return Cache::remember("xf_alerts_{$userId}", 60, function() use($userId) {
return $this->get("alerts?page=1&cutoff=7days", $userId);
$result = $this->get("alerts?page=1&cutoff=7days", $userId);
if (is_array($result)) {
if (isset($result['alerts'])) {
$result['alerts'] = collect($result['alerts'])->take(8)->all();
} else {
$result = collect($result)->take(8)->all();
}
}
return $result;
});
}
@@ -88,7 +98,17 @@ class XenforoApiService {
public function getConversations(int $userId): mixed
{
return Cache::remember("xf_conversations_{$userId}", 60, function() use($userId) {
return $this->get("conversations?page=1&receiver_id={$userId}", $userId);
$result = $this->get("conversations?page=1&receiver_id={$userId}", $userId);
if (is_array($result)) {
if (isset($result['conversations'])) {
$result['conversations'] = collect($result['conversations'])->take(8)->all();
} else {
$result = collect($result)->take(8)->all();
}
}
return $result;
});
}