mirror of
https://github.com/flarum/core.git
synced 2025-05-29 10:39:37 +02:00
Use pre-loaded state if applicable. closes flarum/core#89
This commit is contained in:
parent
bb1491e19e
commit
3334063740
@ -295,6 +295,11 @@ class Discussion extends Model
|
||||
*/
|
||||
public function stateFor(User $user)
|
||||
{
|
||||
$loadedState = array_get($this->relations, 'state');
|
||||
if ($loadedState && $loadedState->user_id === $user->id) {
|
||||
return $loadedState;
|
||||
}
|
||||
|
||||
$state = $this->state($user)->first();
|
||||
|
||||
if (! $state) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user