mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-06 18:31:05 +00:00
fix(notifications): remove cache inconsistencies when marking notification as read
This commit is contained in:
parent
2e7b462d94
commit
46d70541d3
@ -22,15 +22,6 @@ class ActorModel extends FediverseActorModel
|
|||||||
|
|
||||||
public function getActorById(int $id): ?Actor
|
public function getActorById(int $id): ?Actor
|
||||||
{
|
{
|
||||||
$cacheName = config('Fediverse')
|
return $this->find($id);
|
||||||
->cachePrefix . "actor#{$id}";
|
|
||||||
if (! ($found = cache($cacheName))) {
|
|
||||||
$found = $this->find($id);
|
|
||||||
|
|
||||||
cache()
|
|
||||||
->save($cacheName, $found, DECADE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $found;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,7 @@ class NotificationController extends BaseController
|
|||||||
|
|
||||||
$post = (new PostModel())->getPostById($this->notification->post_id);
|
$post = (new PostModel())->getPostById($this->notification->post_id);
|
||||||
|
|
||||||
return redirect()->route(
|
return redirect()->route('post', [$this->podcast->handle, $post->id]);
|
||||||
'post',
|
|
||||||
[esc((new PodcastModel())->getPodcastByActorId($this->notification->actor_id)->handle), $post->id]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function markAllAsRead(): RedirectResponse
|
public function markAllAsRead(): RedirectResponse
|
||||||
|
@ -61,16 +61,7 @@ class ActorModel extends BaseModel
|
|||||||
|
|
||||||
public function getActorById(int $id): ?Actor
|
public function getActorById(int $id): ?Actor
|
||||||
{
|
{
|
||||||
$cacheName = config('Fediverse')
|
return $this->find($id);
|
||||||
->cachePrefix . "actor#{$id}";
|
|
||||||
if (! ($found = cache($cacheName))) {
|
|
||||||
$found = $this->find($id);
|
|
||||||
|
|
||||||
cache()
|
|
||||||
->save($cacheName, $found, DECADE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $found;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,16 +89,7 @@ class PostModel extends BaseUuidModel
|
|||||||
|
|
||||||
public function getPostById(string $postId): ?Post
|
public function getPostById(string $postId): ?Post
|
||||||
{
|
{
|
||||||
$cacheName = config('Fediverse')
|
return $this->find($postId);
|
||||||
->cachePrefix . "post#{$postId}";
|
|
||||||
if (! ($found = cache($cacheName))) {
|
|
||||||
$found = $this->find($postId);
|
|
||||||
|
|
||||||
cache()
|
|
||||||
->save($cacheName, $found, DECADE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $found;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPostByUri(string $postUri): ?Post
|
public function getPostByUri(string $postUri): ?Post
|
||||||
|
Loading…
x
Reference in New Issue
Block a user