mirror of
https://github.com/flarum/core.git
synced 2025-07-25 02:31:17 +02:00
Use pre-loaded state if applicable. closes flarum/core#89
This commit is contained in:
@@ -295,6 +295,11 @@ class Discussion extends Model
|
|||||||
*/
|
*/
|
||||||
public function stateFor(User $user)
|
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();
|
$state = $this->state($user)->first();
|
||||||
|
|
||||||
if (! $state) {
|
if (! $state) {
|
||||||
|
Reference in New Issue
Block a user