Merge branch 'master' into develop

This commit is contained in:
Lucas Bartholemy 2024-11-07 18:38:02 +01:00
commit 8b010e8280
5 changed files with 34 additions and 24 deletions

View File

@ -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)
--------------------------

View File

@ -235,12 +235,17 @@ 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_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) {
$this->created_by ??= Yii::$app->user->id;

View File

@ -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!'],
];

View File

@ -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 != "") {
if (empty($this->$attribute)) {
return;
}
foreach ($this->getEmails() as $email) {
$validator = new EmailValidator();
$validator = new StringValidator(['max' => 150]);
if (!$validator->validate($email)) {
$this->addError($attribute, Yii::t('UserModule.invite', '{email} is not valid!', ["{email}" => $email]));
$this->addError($attribute, Yii::t('UserModule.invite', '{email} should contain at most {charNum} characters.', ['email' => $email, 'charNum' => 150]));
continue;
}
if (User::findOne(['email' => $email]) != null) {
$this->addError($attribute, Yii::t('UserModule.invite', '{email} is already registered!', ["{email}" => $email]));
$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]));
}
}
}

View File

@ -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) {