Use integer format for Content columns "visibility" and "state" right after creating (#6373)

This commit is contained in:
Yuriy Bakhtin 2023-06-05 13:25:50 +04:00 committed by GitHub
parent 1b3219582f
commit 0f5ef6b2f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -6,6 +6,7 @@ HumHub Changelog
- Fix #6345: Fix updating of post on wall stream
- Fix #6351: Error when config `defaultReloadableScripts` is not array
- Fix #6359: Avoid double call of `afterSave` on creating of a published content
- Fix #6373: Use integer format for Content columns "visibility" and "state" right after creating
1.14.2 (May 22, 2023)
----------------------

View File

@ -113,11 +113,13 @@ class ContentStateService extends Component
*/
public function set($state, array $options = []): bool
{
$state = (int) $state;
if (!$this->canChange($state)) {
return false;
}
if ((int) $state === Content::STATE_SCHEDULED) {
if ($state === Content::STATE_SCHEDULED) {
if (empty($options['scheduled_at'])) {
return false;
}

View File

@ -107,8 +107,8 @@ abstract class WallCreateContentForm extends Widget
{
Yii::$app->response->format = 'json';
$visibility = Yii::$app->request->post('visibility', Content::VISIBILITY_PRIVATE);
if ($visibility == Content::VISIBILITY_PUBLIC && !$contentContainer->can(CreatePublicContent::class)) {
$visibility = (int) Yii::$app->request->post('visibility', Content::VISIBILITY_PRIVATE);
if ($visibility === Content::VISIBILITY_PUBLIC && !$contentContainer->can(CreatePublicContent::class)) {
$visibility = Content::VISIBILITY_PRIVATE;
}