mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-24 03:59:08 -05:00
fix: eager loading of user for echo and audible eloquent resources
This commit is contained in:
@@ -304,7 +304,7 @@ class NerdBot
|
||||
$echoes = cache()->remember(
|
||||
'user-echoes'.$target->id,
|
||||
3600,
|
||||
fn () => UserEcho::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get()
|
||||
fn () => UserEcho::with(['user', 'room', 'target', 'bot'])->where('user_id', '=', $target->id)->get()
|
||||
);
|
||||
|
||||
if ($echoes->doesntContain(fn ($echo) => $echo->bot_id == $this->bot->id)) {
|
||||
@@ -322,7 +322,7 @@ class NerdBot
|
||||
$audibles = cache()->remember(
|
||||
'user-audibles'.$target->id,
|
||||
3600,
|
||||
fn () => UserAudible::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get()
|
||||
fn () => UserAudible::with(['user', 'room', 'target', 'bot'])->where('user_id', '=', $target->id)->get()
|
||||
);
|
||||
|
||||
if ($audibles->doesntContain(fn ($audible) => $audible->bot_id == $this->bot->id)) {
|
||||
|
||||
@@ -181,7 +181,7 @@ class SystemBot
|
||||
$echoes = cache()->remember(
|
||||
'user-echoes'.$target->id,
|
||||
3600,
|
||||
fn () => UserEcho::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get()
|
||||
fn () => UserEcho::with(['user', 'room', 'target', 'bot'])->where('user_id', '=', $target->id)->get()
|
||||
);
|
||||
|
||||
if ($echoes->doesntContain(fn ($echo) => $echo->bot_id == $this->bot->id)) {
|
||||
@@ -199,7 +199,7 @@ class SystemBot
|
||||
$audibles = cache()->remember(
|
||||
'user-audibles'.$target->id,
|
||||
3600,
|
||||
fn () => UserAudible::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get()
|
||||
fn () => UserAudible::with(['user', 'room', 'target', 'bot'])->where('user_id', '=', $target->id)->get()
|
||||
);
|
||||
|
||||
if ($audibles->doesntContain(fn ($audible) => $audible->bot_id == $this->bot->id)) {
|
||||
|
||||
@@ -196,7 +196,7 @@ class ChatController extends Controller
|
||||
$echoes = cache()->remember(
|
||||
'user-echoes'.$user1Id,
|
||||
3600,
|
||||
fn () => UserEcho::with(['room', 'target', 'bot'])->where('user_id', '=', $user1Id)->get()
|
||||
fn () => UserEcho::with(['user', 'room', 'target', 'bot'])->where('user_id', '=', $user1Id)->get()
|
||||
);
|
||||
|
||||
if ($echoes->doesntContain(fn ($echo) => $echo->target_id == $user2Id)) {
|
||||
@@ -216,7 +216,7 @@ class ChatController extends Controller
|
||||
$audibles = cache()->remember(
|
||||
'user-audibles'.$user1Id,
|
||||
3600,
|
||||
fn () => UserAudible::with(['room', 'target', 'bot'])->where('user_id', '=', $user1Id)->get()
|
||||
fn () => UserAudible::with(['user', 'room', 'target', 'bot'])->where('user_id', '=', $user1Id)->get()
|
||||
);
|
||||
|
||||
if ($audibles->doesntContain(fn ($audible) => $audible->target_id == $user2Id)) {
|
||||
@@ -403,7 +403,7 @@ class ChatController extends Controller
|
||||
$echoes = cache()->remember(
|
||||
'user-echoes'.$user->id,
|
||||
3600,
|
||||
fn () => UserEcho::with(['room', 'target', 'bot'])->where('user_id', '=', $user->id)->get(),
|
||||
fn () => UserEcho::with(['user', 'room', 'target', 'bot'])->where('user_id', '=', $user->id)->get(),
|
||||
);
|
||||
|
||||
if ($echoes->doesntContain(fn ($echo) => $echo->room_id == $room->id)) {
|
||||
|
||||
Reference in New Issue
Block a user