From db6def1285307af68a03e95a976ffe909491ef79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20E=C3=9Fl?= <indy.essl@gmail.com>
Date: Tue, 18 Feb 2020 20:23:00 +0100
Subject: [PATCH] [BUGFIX] Prevent empty div in RecordHistory Rollback

In the RecordHistory Rollback template it can happen, that the
historyRow is missing messages about its differences. In this case, an
empty div with a weird looking border would still be visible in the
html. This patch fixes this by wrapping an if condition around the div,
that checks first, if the needed information is available.

Resolves: #90424
Releases: master, 9.5
Change-Id: Icdd5dbf1b1008ab6a64a2b241982450bd385a8f8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63314
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
---
 .../Partials/RecordHistory/MultipleDiff.html  | 26 ++++++++++---------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/typo3/sysext/backend/Resources/Private/Partials/RecordHistory/MultipleDiff.html b/typo3/sysext/backend/Resources/Private/Partials/RecordHistory/MultipleDiff.html
index 7d0731837e53..1ee9c8279eaa 100644
--- a/typo3/sysext/backend/Resources/Private/Partials/RecordHistory/MultipleDiff.html
+++ b/typo3/sysext/backend/Resources/Private/Partials/RecordHistory/MultipleDiff.html
@@ -11,18 +11,20 @@
                         {historyRow.title}
                     </h3>
                     <div>
-                        <div
-                            style="padding-left:10px;border-left:5px solid darkgray;border-bottom:1px dotted darkgray;padding-bottom:2px;">
-                            <f:if condition="{historyRow.insertDelete} == 'delete'">
-                                <strong>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_show_rechis.xlf:delete')}</strong><br/>
-                            </f:if>
-                            <f:if condition="{historyRow.insertDelete} == 'insert'">
-                                <strong>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_show_rechis.xlf:insert')}</strong><br/>
-                            </f:if>
-                            <f:if condition="{historyRow.differences}">
-                                <f:render partial="RecordHistory/Diff" arguments="{differences: historyRow.differences}"/>
-                            </f:if>
-                        </div>
+                        <f:if condition="{historyRow.insertDelete} || {historyRow.differences -> f:count()}">
+                            <div
+                                style="padding-left:10px;border-left:5px solid darkgray;border-bottom:1px dotted darkgray;padding-bottom:2px;">
+                                <f:if condition="{historyRow.insertDelete} == 'delete'">
+                                    <strong>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_show_rechis.xlf:delete')}</strong><br/>
+                                </f:if>
+                                <f:if condition="{historyRow.insertDelete} == 'insert'">
+                                    <strong>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_show_rechis.xlf:insert')}</strong><br/>
+                                </f:if>
+                                <f:if condition="{historyRow.differences}">
+                                    <f:render partial="RecordHistory/Diff" arguments="{differences: historyRow.differences}"/>
+                                </f:if>
+                            </div>
+                        </f:if>
                     </div>
                 </f:for>
             </div>
-- 
GitLab