Allow point reversion policies to be customized for each module

This commit is contained in:
Kijin Sung 2025-09-04 21:47:28 +09:00
parent 5f8586ec8f
commit 7a6400f39d
4 changed files with 43 additions and 13 deletions

View file

@ -257,7 +257,7 @@ class PointAdminController extends Point
}
$config = [];
$keys = [
$numeric_keys = [
'insert_document',
'insert_comment',
'upload_file',
@ -274,8 +274,13 @@ class PointAdminController extends Point
'voted_comment',
'blamed_comment'
];
$boolean_keys = [
'insert_document_revert_on_delete',
'insert_comment_revert_on_delete',
'upload_file_revert_on_delete'
];
foreach ($keys as $key)
foreach ($numeric_keys as $key)
{
$value = trim(Context::get($key) ?? '');
if ($value !== '')
@ -283,6 +288,14 @@ class PointAdminController extends Point
$config[$key] = (int)$value;
}
}
foreach ($boolean_keys as $key)
{
$value = trim(Context::get($key) ?? '');
if ($value !== '')
{
$config[$key] = ($value === 'Y');
}
}
$oModuleController->insertModulePartConfig('point', $srl, $config);
}