diff --git a/CHANGELOG.md b/CHANGELOG.md index 533c0d207e..b182780f67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,9 @@ HumHub Changelog - Fix #7232: Refresh the updated_at timestamp of invitation after resend it - Fix #7241: Fix file visibility for object with viewable interface - Enh #7229: Hide invitations with unknown sources +- Fix #7276: Cron jobs cannot "Create public content" (since 1.15.3) +- Fix #7278: Don't remove html tags by JS from search post record because it is done by PHP +- Fix #7296: Fix email validation of invite new users 1.16.2 (September 5, 2024) -------------------------- diff --git a/protected/humhub/modules/content/models/Content.php b/protected/humhub/modules/content/models/Content.php index d4ec8b1cb3..cc06f3e1a1 100644 --- a/protected/humhub/modules/content/models/Content.php +++ b/protected/humhub/modules/content/models/Content.php @@ -235,11 +235,16 @@ class Content extends ActiveRecord implements Movable, ContentOwner, Archiveable // Force to private content for private space or if user has no permission to create public content if ($this->container instanceof Space && $this->container->visibility !== Space::VISIBILITY_ALL && - $this->visibility === self::VISIBILITY_PUBLIC) { - if ($this->container->visibility === Space::VISIBILITY_NONE || - !$this->container->can(CreatePublicContent::class)) { - $this->visibility = self::VISIBILITY_PRIVATE; - } + $this->visibility === self::VISIBILITY_PUBLIC && + ( + $this->container->visibility === Space::VISIBILITY_NONE || + ( + Yii::$app->user->identity && // Allow creating public content from console + !$this->container->can(CreatePublicContent::class) + ) + ) + ) { + $this->visibility = self::VISIBILITY_PRIVATE; } if ($insert) { diff --git a/protected/humhub/modules/user/models/forms/AccountChangeEmail.php b/protected/humhub/modules/user/models/forms/AccountChangeEmail.php index 44b8417c8c..f3b6a5991b 100644 --- a/protected/humhub/modules/user/models/forms/AccountChangeEmail.php +++ b/protected/humhub/modules/user/models/forms/AccountChangeEmail.php @@ -38,6 +38,7 @@ class AccountChangeEmail extends Model { $rules = [ ['newEmail', 'required'], + ['newEmail', 'string', 'max' => 150], ['newEmail', 'email'], ['newEmail', 'unique', 'targetAttribute' => 'email', 'targetClass' => User::class, 'message' => '{attribute} "{value}" is already in use!'], ]; diff --git a/protected/humhub/modules/user/models/forms/Invite.php b/protected/humhub/modules/user/models/forms/Invite.php index 5f15795078..52a9fdc9a3 100644 --- a/protected/humhub/modules/user/models/forms/Invite.php +++ b/protected/humhub/modules/user/models/forms/Invite.php @@ -20,6 +20,7 @@ use yii\base\InvalidConfigException; use yii\base\Model; use yii\helpers\Url; use yii\validators\EmailValidator; +use yii\validators\StringValidator; /** * Invite Form Model @@ -49,22 +50,28 @@ class Invite extends Model * E-Mails needs to be valid and not already registered. * * @param string $attribute - * @param array $params */ - public function checkEmails($attribute, $params) + public function checkEmails($attribute) { - if ($this->$attribute != "") { - foreach ($this->getEmails() as $email) { - $validator = new EmailValidator(); - if (!$validator->validate($email)) { - $this->addError($attribute, Yii::t('UserModule.invite', '{email} is not valid!', ["{email}" => $email])); - continue; - } + if (empty($this->$attribute)) { + return; + } - if (User::findOne(['email' => $email]) != null) { - $this->addError($attribute, Yii::t('UserModule.invite', '{email} is already registered!', ["{email}" => $email])); - continue; - } + foreach ($this->getEmails() as $email) { + $validator = new StringValidator(['max' => 150]); + if (!$validator->validate($email)) { + $this->addError($attribute, Yii::t('UserModule.invite', '{email} should contain at most {charNum} characters.', ['email' => $email, 'charNum' => 150])); + continue; + } + + $validator = new EmailValidator(); + if (!$validator->validate($email)) { + $this->addError($attribute, Yii::t('UserModule.invite', '{email} is not valid!', ['email' => $email])); + continue; + } + + if (User::find()->where(['email' => $email])->exists()) { + $this->addError($attribute, Yii::t('UserModule.invite', '{email} is already registered!', ['email' => $email])); } } } diff --git a/static/js/humhub/humhub.ui.search.js b/static/js/humhub/humhub.ui.search.js index 385dbb36f3..f4ecf90cd3 100644 --- a/static/js/humhub/humhub.ui.search.js +++ b/static/js/humhub/humhub.ui.search.js @@ -302,12 +302,6 @@ humhub.module('ui.search', function(module, require, $) { // Prepare and set new content const newProviderContent = $(response.html); - newProviderContent.find('[data-ui-widget="ui.richtext.prosemirror.RichText"]').each(function () { - Widget.instance($(this)); - }); - newProviderContent.find(that.selectors.providerRecordText + ' > span').each(function () { - $(this).html($(this).html().replace(/(<([^>]+)>)/gi, ' ')); - }); provider.replaceWith(newProviderContent); const records = newProviderContent.find(that.selectors.providerRecord); if (records.length) {