Skip to content

Commit

Permalink
Merge branch 'rel-11_0' into rel-11_1
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Jan 23, 2025
2 parents b6ec2e0 + 82ed383 commit 7374a64
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Kernel/Config/Files/XML/Ticket.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,7 @@
<Item Key="Incident">#bb2222</Item>
</Hash>
</Item>
<Item Key="Translate">0</Item>
<Item Key="Translate">1</Item>
<Item Key="Link"></Item>
</Hash>
</Value>
Expand Down Expand Up @@ -1964,7 +1964,7 @@
<Hash>
<Item Key="Order">2</Item>
<Item Key="Prefix"></Item>
<Item Key="ColorDefault"></Item>
<Item Key="ColorDefault">#949494</Item>
<Item Key="ColorSelection">
<Hash>
</Hash>
Expand All @@ -1989,9 +1989,9 @@
<Item Key="closed successful">#0044dd</Item>
</Hash>
</Item>
<Item Key="Translate">0</Item>
<Item Key="Translate">1</Item>
<Item Key="Link"></Item>
<Item Key="Text"></Item>
<Item Key="Text">[% Data.Value %]</Item>
</Hash>
</Value>
</Setting>
Expand Down
15 changes: 10 additions & 5 deletions Kernel/Modules/AdminProcessManagementActivity.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ sub Run {
my $ActivityID = $ParamObject->GetParam( Param => 'ID' ) || '';
my $EntityID = $ParamObject->GetParam( Param => 'EntityID' ) || '';

# get latest config data to send it back to main window
my $ActivityConfig = $Self->_GetActivityConfig(
EntityID => $EntityID,
);

my %SessionData = $Kernel::OM->Get('Kernel::System::AuthSession')->GetSessionIDData(
SessionID => $Self->{SessionID},
);

if ( !exists $SessionData{ProcessManagementScreensPath} ) {

# get latest config data to send it back to main window
my $ActivityConfig = $Self->_GetActivityConfig(
EntityID => $EntityID,
);

# we lost session in between, close the popup and reload
return $Self->_PopupResponse(
ClosePopup => 1,
Expand Down Expand Up @@ -211,6 +211,11 @@ sub Run {

my $Redirect = $ParamObject->GetParam( Param => 'PopupRedirect' ) || '';

# get latest config data to send it back to main window
my $ActivityConfig = $Self->_GetActivityConfig(
EntityID => $EntityID,
);

# check if needed to open another window or if popup should go back
if ( $Redirect && $Redirect eq '1' ) {

Expand Down
100 changes: 100 additions & 0 deletions scripts/test/HTMLUtils/Safety.t
Original file line number Diff line number Diff line change
Expand Up @@ -1338,4 +1338,104 @@ for my $Test (@TestsWithExplicitConfig) {
};
}

# Some tests concerning special characters.
#
# Note that the 'Replace' attribute of the result is usually 0. This is because
# the replacements done be HTML::Scrubber directly are not counted.
#
# Special cases are:
# CharOnlyStripped: when only a single character is passed
my @TestsWithSpecialChars = (
{
Name => 'less-than sign',
Char => q{<},
Replacement => '&lt;',
CharOnlyStripped => 1,
Line => __LINE__,
},
{
Name => 'greater-than sign',
Char => q{>},
Replacement => '&gt;',
Line => __LINE__,
},
{
Name => 'ampersand',
Char => q{&},
Replacement => '&',
Line => __LINE__,
},
{
Name => 'quotation mark',
Char => q{"},
Replacement => q{"},
Line => __LINE__,
},
{
Name => 'apostrophe',
Char => q{'},
Replacement => q{'},
Line => __LINE__,
},
{
Name => 'snowman',
Char => q{},
Replacement => q{},
Line => __LINE__,
},
{
Name => 'semicolon',
Char => q{;},
Replacement => q{;},
Line => __LINE__,
},
);

for my $Test (@TestsWithSpecialChars) {

subtest "Special char '$Test->{Name}' (line @{[ $Test->{Line} // '???' ]})" => sub {

my $ToDo = $Test->{Todo} ? todo( $Test->{Todo} ) : undef;

# replacement by HTML::Scrubber are not counted
{
my %Result = $HTMLUtilsObject->Safety(
String => $Test->{Char},
);
is( $Result{Replace}, 0, 'char only replaced' );
if ( $Test->{CharOnlyStripped} ) {
is( $Result{String}, '', 'char only result, stripped' );
}
else {
is( $Result{String}, $Test->{Replacement}, 'char only result' );
}
}

{
my %Result = $HTMLUtilsObject->Safety(
String => qq{before $Test->{Char} after},
);
is( $Result{Replace}, 0, 'surrounded char replaced' );
is( $Result{String}, qq{before $Test->{Replacement} after}, 'surrounded char result' );
}

{
my %Result = $HTMLUtilsObject->Safety(
String => qq{<b>$Test->{Char}</b>},
);
is( $Result{Replace}, 0, 'bold char replaced' );
is( $Result{String}, qq{<b>$Test->{Replacement}</b>}, 'bold char result' );
}

{
my %Result = $HTMLUtilsObject->Safety(
String => qq{<applet>$Test->{Char}</applet>},
NoApplet => 1,
);
is( $Result{Replace}, 0, 'applet replaced' );
is( $Result{String}, qq{$Test->{Replacement}}, 'applet result' );
}
};
}

done_testing;

0 comments on commit 7374a64

Please sign in to comment.