Increase maximum length of automatic deletion summaries
authorDannyS712 <DannyS712.enwiki@gmail.com>
Wed, 21 Aug 2019 23:13:16 +0000 (23:13 +0000)
committerDannyS712 <DannyS712.enwiki@gmail.com>
Thu, 22 Aug 2019 00:42:59 +0000 (00:42 +0000)
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

includes/content/ContentHandler.php
tests/phpunit/includes/page/WikiPageDbTestBase.php

index 48dfc70..ea5ab78 100644 (file)
@@ -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 );
index cbafbe9..30973c8 100644 (file)
@@ -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
                                        ],
                                ],