mirror of
https://github.com/humhub/humhub.git
synced 2025-04-20 15:11:52 +02:00
Merge branch 'master' into fix/602-catch-error-in-file-handlers
This commit is contained in:
commit
dc2e894892
10
.github/workflows/php-test.yml
vendored
10
.github/workflows/php-test.yml
vendored
@ -1,6 +1,7 @@
|
||||
name: PHP Codeception Tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@ -56,7 +57,7 @@ jobs:
|
||||
steps:
|
||||
- name: Start Selenium
|
||||
run: |
|
||||
docker run --detach --net=host --shm-size="2g" selenium/standalone-chrome
|
||||
docker run --detach --net=host --shm-size="2g" selenium/standalone-chrome:108.0-20250123
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
@ -119,7 +120,7 @@ jobs:
|
||||
run: php protected/humhub/tests/codeception/bin/yii installer/auto
|
||||
|
||||
- name: Rebuild search index
|
||||
run: php protected/humhub/tests/codeception/bin/yii search/rebuild
|
||||
run: php protected/humhub/tests/codeception/bin/yii content-search/rebuild
|
||||
|
||||
- name: Run test server
|
||||
run: php --server 127.0.0.1:8080 index-test.php &>/tmp/phpserver.log &
|
||||
@ -138,4 +139,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: codeception-output
|
||||
path: protected/humhub/tests/codeception/_output/*
|
||||
path: |
|
||||
protected/humhub/tests/codeception/_output/*
|
||||
protected/humhub/modules/*/tests/codeception/_output/*
|
||||
protected/runtime/logs/*
|
||||
|
@ -5,6 +5,7 @@ HumHub Changelog
|
||||
----------------------
|
||||
- Fix #7484: Use password type on the installation DB config form
|
||||
- Fix #7486: Catch errors in external file handlers
|
||||
- Fix #7487: Fix comments list when comment is active from another parent comment
|
||||
|
||||
1.17.2 (April 7, 2025)
|
||||
----------------------
|
||||
|
@ -65,9 +65,7 @@ class Comments extends Widget
|
||||
{
|
||||
$objectModel = PolymorphicRelation::getObjectModel($this->object);
|
||||
$objectId = $this->object->getPrimaryKey();
|
||||
|
||||
$streamQuery = Yii::$app->request->getQueryParam('StreamQuery');
|
||||
$currentCommentId = empty($streamQuery['commentId']) ? null : $streamQuery['commentId'];
|
||||
$currentCommentId = $this->getCurrentCommentId();
|
||||
|
||||
// Count all Comments
|
||||
$commentCount = CommentModel::GetCommentCount($objectModel, $objectId);
|
||||
@ -101,4 +99,27 @@ class Comments extends Widget
|
||||
{
|
||||
return $this->isFullViewMode() ? $this->module->commentsBlockLoadSizeViewMode : $this->module->commentsBlockLoadSize;
|
||||
}
|
||||
|
||||
protected function getCurrentCommentId(): ?int
|
||||
{
|
||||
$streamQuery = Yii::$app->request->getQueryParam('StreamQuery');
|
||||
if (empty($streamQuery['commentId'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$currentCommentId = (int) $streamQuery['commentId'];
|
||||
|
||||
$currentComment = Yii::$app->runtimeCache->getOrSet('getCurrentComment' . $currentCommentId, function () use ($currentCommentId) {
|
||||
return CommentModel::findOne(['id' => $currentCommentId]);
|
||||
});
|
||||
|
||||
if (!$currentComment ||
|
||||
$currentComment->object_id !== $this->object?->id ||
|
||||
$currentComment->object_model !== get_class($this->object)) {
|
||||
// The current comment is from another parent object
|
||||
return null;
|
||||
}
|
||||
|
||||
return $currentCommentId;
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ class Content extends ActiveRecord implements Movable, ContentOwner, Archiveable
|
||||
/**
|
||||
* @since 1.3
|
||||
*/
|
||||
public function getModel(): ContentActiveRecord
|
||||
public function getModel(): ?ContentActiveRecord
|
||||
{
|
||||
return $this->getPolymorphicRelation();
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ return array (
|
||||
'Invalid Mime-Type' => 'Неправильный MIME-тип файла',
|
||||
'Last update by:' => 'Последнее обновление:',
|
||||
'Size:' => 'Размер:',
|
||||
'Sorry, you can only upload up to {n,plural,=1{# file} other{# files}} at once.' => 'К сожалению, вы можете загрузить только до {n, plural, =1{# файла} many{# файлов}} одновременно.',
|
||||
'Sorry, you can only upload up to {n,plural,=1{# file} other{# files}} at once.' => 'К сожалению, вы можете загрузить только до {n,plural,=1{# файла} other{# файлов}} одновременно.',
|
||||
'The uploaded image is not a squared.' => 'Загруженное изображение не квадратное.',
|
||||
'This upload field only allows a maximum of {n,plural,=1{# file} other{# files}}.' => 'Это поле загрузки допускает максимум {n,plural,=1{# файл} few{# файла} many{# файлов}}.',
|
||||
'This upload field only allows a maximum of {n,plural,=1{# file} other{# files}}.' => 'Это поле загрузки допускает максимум {n,plural,=1{# файл} other{# файлов}}.',
|
||||
'Upload files' => 'Загрузить файлы',
|
||||
);
|
||||
|
@ -315,7 +315,7 @@ class BaseType extends Model
|
||||
$query = $db->getQueryBuilder()->dropColumn(Profile::tableName(), $this->profileField->internal_name);
|
||||
$db->createCommand($query)->execute();
|
||||
} else {
|
||||
Yii::error('Could not delete profile column - not exists!');
|
||||
Yii::error('Could not delete profile column "' . $columnName . '" - not exists!');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,5 @@ return [
|
||||
['user_id' => 5, 'firstname' => 'Disabled', 'lastname' => 'User'],
|
||||
['user_id' => 6, 'firstname' => 'UnApproved', 'lastname' => 'User'],
|
||||
['user_id' => 7, 'firstname' => 'UnApprovedNoGroup', 'lastname' => 'User'],
|
||||
['user_id' => 8, 'firstname' => 'AdminNotMember', 'lastname' => 'User'],
|
||||
];
|
||||
|
@ -31,7 +31,7 @@ class PeopleFiltersTest extends HumHubDbTestCase
|
||||
ProfileField::updateAll(['directory_filter' => 1], ['IN', 'internal_name', ['firstname', 'lastname']]);
|
||||
$peopleFilters = new PeopleFilters();
|
||||
|
||||
$this->assertEquals(['Admin', 'Andreas', 'Peter', 'Sara'], $this->getFilterOptions('fields[firstname]', $peopleFilters));
|
||||
$this->assertEquals(['Admin', 'AdminNotMember', 'Andreas', 'Peter', 'Sara'], $this->getFilterOptions('fields[firstname]', $peopleFilters));
|
||||
}
|
||||
|
||||
public function testReducedFilters()
|
||||
@ -52,8 +52,8 @@ class PeopleFiltersTest extends HumHubDbTestCase
|
||||
// Filter by firstname
|
||||
$peopleQuery = new PeopleQuery(['defaultFilters' => ['fields' => ['firstname' => 'Admin']]]);
|
||||
$peopleFilters = new PeopleFilters(['query' => $peopleQuery]);
|
||||
$this->assertEquals(['Admin'], $this->getFilterOptions('fields[firstname]', $peopleFilters));
|
||||
$this->assertEquals(['AdminLastName'], $this->getFilterOptions('fields[lastname]', $peopleFilters));
|
||||
$this->assertEquals(['Admin', 'AdminNotMember'], $this->getFilterOptions('fields[firstname]', $peopleFilters));
|
||||
$this->assertEquals(['AdminLastName', 'User'], $this->getFilterOptions('fields[lastname]', $peopleFilters));
|
||||
$this->assertEquals(['' => 'Any', 1 => 'Administrator'], $this->getFilterOptions('groupId', $peopleFilters));
|
||||
|
||||
// Filter by group
|
||||
|
@ -36,6 +36,14 @@ class Image extends BaseImage
|
||||
|
||||
public bool $showSelfOnlineStatus = false;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function beforeRun()
|
||||
{
|
||||
return parent::beforeRun() && $this->user instanceof User;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace tests\codeception\_support;
|
||||
|
||||
use Codeception\Module;
|
||||
use Codeception\TestInterface;
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
@ -40,4 +41,35 @@ class WebHelper extends Module
|
||||
Yii::$app->moduleManager->enableModules($cfg['humhub_modules']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function _failed(TestInterface $test, $fail)
|
||||
{
|
||||
parent::_failed($test, $fail);
|
||||
|
||||
$filePath = codecept_output_dir() . str_replace(['\\', '/', ':', ' '], '.', $test->getSignature());
|
||||
|
||||
$logFilePath = Yii::getAlias('@runtime/logs') . DIRECTORY_SEPARATOR . 'app.log';
|
||||
if (file_exists($logFilePath)) {
|
||||
copy($logFilePath, $filePath . '.app.log');
|
||||
}
|
||||
|
||||
if (!Yii::$app->db->isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
preg_match('/host=([^;]+)/', Yii::$app->db->dsn, $hostMatch);
|
||||
preg_match('/dbname=([^;]+)/', Yii::$app->db->dsn, $dbMatch);
|
||||
|
||||
exec(sprintf(
|
||||
'mysqldump --skip-column-statistics -u%s -p%s -h%s %s > %s',
|
||||
escapeshellarg(Yii::$app->db->username ?? 'root'),
|
||||
escapeshellarg(Yii::$app->db->password ?? 'root'),
|
||||
escapeshellarg($hostMatch[1] ?? '127.0.0.1'),
|
||||
escapeshellarg($dbMatch[1] ?? 'humhub_test'),
|
||||
escapeshellarg($filePath . '.dump.sql'),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user