Update Models\PM\PTopic

This commit is contained in:
Visman 2021-04-03 23:03:23 +07:00
parent 3f340482ac
commit 96a2433d61

View file

@ -30,12 +30,12 @@ class PTopic extends DataModel
'num_replies' => ['numPages', 'pagination'],
'poster' => ['last_poster', 'byOrFor', 'zpUser', 'ztUser'],
'poster_id' => ['closed', 'firstNew', 'zp', 'zt', 'zpUser', 'ztUser', 'actionsAllowed', 'canReply'],
'poster_status' => ['closed', 'actionsAllowed', 'canReply'],
'poster_status' => ['closed', 'actionsAllowed', 'canReply', 'isFullDeleted'],
'poster_visit' => ['firstNew'],
'subject' => ['name'],
'target' => ['last_poster', 'byOrFor', 'zpUser', 'ztUser'],
'target_id' => ['closed', 'firstNew', 'zp', 'zt', 'zpUser', 'ztUser', 'actionsAllowed', 'canReply'],
'target_status' => ['closed', 'actionsAllowed', 'canReply'],
'target_status' => ['closed', 'actionsAllowed', 'canReply', 'isFullDeleted'],
'target_visit' => ['firstNew'],
];
}
@ -387,7 +387,7 @@ class PTopic extends DataModel
$this->{"{$this->zp}_visit"} = $this->last_post;
$this->c->pms->update(Cnst::PTOPIC, $this);
$this->c->pms->updateFromPTopics(false, $this);
$this->c->pms->recalculate($this->zpUser);
}
/**
@ -489,4 +489,19 @@ class PTopic extends DataModel
|| $this->ztUser->isAdmin
);
}
/**
* Статус удаления диалога у обоих собеседников
*/
protected function getisFullDeleted(): bool
{
return (
Cnst::PT_DELETED === $this->poster_status
|| Cnst::PT_NOTSENT === $this->poster_status
)
&& (
Cnst::PT_DELETED === $this->target_status
|| Cnst::PT_NOTSENT === $this->target_status
);
}
}