From: DannyS712 Date: Wed, 21 Aug 2019 23:13:16 +0000 (+0000) Subject: Increase maximum length of automatic deletion summaries X-Git-Tag: 1.34.0-rc.0~634^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=08ee999b70c8baa31222259a6e77e59412f00562;p=lhc%2Fweb%2Fwiklou.git Increase maximum length of automatic deletion summaries Currently, the maximum length is hardcoded to 255 characters. Instead, the maximum length should be based on the actually enforce comment store limit. Bug: T230962 Change-Id: I4379057f8f49fd8e5efa620164eea2867fde1bfc --- diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 48dfc70090..ea5ab78bc0 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -1077,7 +1077,8 @@ abstract class ContentHandler { } // Max content length = max comment length - length of the comment (excl. $1) - $text = $content ? $content->getTextForSummary( 255 - ( strlen( $reason ) - 2 ) ) : ''; + $maxLength = CommentStore::COMMENT_CHARACTER_LIMIT - ( strlen( $reason ) - 2 ); + $text = $content ? $content->getTextForSummary( $maxLength ) : ''; // Now replace the '$1' placeholder $reason = str_replace( '$1', $text, $reason ); diff --git a/tests/phpunit/includes/page/WikiPageDbTestBase.php b/tests/phpunit/includes/page/WikiPageDbTestBase.php index cbafbe901a..30973c8f67 100644 --- a/tests/phpunit/includes/page/WikiPageDbTestBase.php +++ b/tests/phpunit/includes/page/WikiPageDbTestBase.php @@ -1434,7 +1434,13 @@ more stuff . " nonumy eirmod tempor invidunt ut labore et dolore magna " . "aliquyam erat, sed diam voluptua. At vero eos et accusam " . "et justo duo dolores et ea rebum. Stet clita kasd gubergren, " - . "no sea takimata sanctus est Lorem ipsum dolor sit amet.'", + . "no sea takimata sanctus est Lorem ipsum dolor sit amet. " + . " this here is some more filler content added to try and " + . "reach the maximum automatic summary length so that this is" + . " truncated ipot sodit colrad ut ad olve amit basul dat" + . "Dorbet romt crobit trop bri. DannyS712 put me here lor pe" + . " ode quob zot bozro see also T22281 for background pol sup" + . "Lorem ipsum dolor sit amet'", null ], ],