Skip to content
Snippets Groups Projects
Commit af662d14 authored by Thomas Hohn's avatar Thomas Hohn Committed by Christian Kuhn
Browse files

[BUGFIX] If User TSConfig disables avatar it gets lost when saved

If the user is not allow to modify the avatar it gets
lost since there was no distinction between deleted and
not allowed to modify causing the avatar to be deleted
on save.

Resolves: #80002
Releases: master
Change-Id: I1cf6fa93c2af1122c481b52860990c2433d86594
Reviewed-on: https://review.typo3.org/51860


Reviewed-by: default avatarJosef Glatz <josef.glatz@typo3.org>
Tested-by: default avatarJosef Glatz <josef.glatz@typo3.org>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
parent 8fad63d4
Branches
Tags
No related merge requests found
......@@ -960,6 +960,11 @@ class SetupModuleController extends AbstractModule
return;
}
// If user is not allowed to modify avatar $fileUid is empty - so don't overwrite existing avatar
if (empty($fileUid)) {
return;
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_file_reference');
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder
......@@ -984,6 +989,11 @@ class SetupModuleController extends AbstractModule
)
->execute();
// If Avatar is marked for delete => set it to empty string so it will be updated properly
if ($fileUid === 'delete') {
$fileUid = '';
}
// Create new reference
if ($fileUid) {
......@@ -1035,7 +1045,7 @@ class SetupModuleController extends AbstractModule
function clearExistingImage() {
$(' . GeneralUtility::quoteJSvalue('#image_' . htmlspecialchars($fieldName)) . ').hide();
$(' . GeneralUtility::quoteJSvalue('#clear_button_' . htmlspecialchars($fieldName)) . ').hide();
$(' . GeneralUtility::quoteJSvalue('#field_' . htmlspecialchars($fieldName)) . ').val(\'\');
$(' . GeneralUtility::quoteJSvalue('#field_' . htmlspecialchars($fieldName)) . ').val(\'delete\');
}
function setFileUid(field, value, fileUid) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment