r42695 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42694‎ | r42695 | r42696 >
Date:22:41, 27 October 2008
Author:mrzman
Status:old (Comments)
Tags:
Comment:
(bug 4253) - recentchanges IRC:
* Don't include the title in diff ULRs
* If the message is still too long, trim the comment.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -613,8 +613,10 @@
614614 $url = $titleObj->getInternalURL();
615615 } else if( $wgUseRCPatrol ) {
616616 $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid&rcid=$rc_id");
 617+ $url = preg_replace('/title=[^&]*&/', '', $url);
617618 } else {
618619 $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid");
 620+ $url = preg_replace('/title=[^&]*&/', '', $url);
619621 }
620622
621623 if( isset( $oldSize ) && isset( $newSize ) ) {
@@ -643,6 +645,20 @@
644646 # no colour (\003) switches back to the term default
645647 $fullString = "\00314[[\00307$title\00314]]\0034 $flag\00310 " .
646648 "\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 $szdiff \00310$comment\003\n";
 649+ # RFC 2812 sets the limit for IRC message length at 512 bytes
 650+ # If the message is longer than that, trim the comment as much as necessary
 651+ # It might still be too long, but there's not much else we can trim without losing anything important
 652+ if ( strlen($fullString) > 512 ) {
 653+ $extra = strlen($fullString) - 512;
 654+ if ( strlen($comment) > $extra ) {
 655+ $comment = substr($comment, 0, strlen($comment) - $extra);
 656+ } else {
 657+ $comment = '';
 658+ }
 659+ $fullString = "\00314[[\00307$title\00314]]\0034 $flag\00310 " .
 660+ "\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 $szdiff \00310$comment\003\n";
 661+ }
 662+
647663 return $fullString;
648664 }
649665
Index: trunk/phase3/RELEASE-NOTES
@@ -287,6 +287,8 @@
288288 * (bug 12764) Special:LonelyPages shows transcluded pages
289289 * (bug 16073) Enhanced RecentChanges uses onclick handler with better fallback if
290290 JavaScript is disabled.
 291+* (bug 4253) Recentchanges IRC messages no longer include title in diff URLs and
 292+ the comment is trimmed if necessary to maintain proper message length.
291293
292294 === API changes in 1.14 ===
293295

Follow-up revisions

RevisionCommit summaryAuthorDate
r42711partial revert of r42695, don't trim the commentmrzman02:38, 28 October 2008
r44406(bug 4253, bug 16586) Don't repeat titles of new pages in URLs in the RC->IRC...vyznev15:56, 10 December 2008

Comments

#Comment by Mr.Z-man (talk | contribs)   02:23, 30 October 2008

Comment trimming removed in r42711

Status & tagging log