maxNoticeLength test for url-shortening failed on maxContent==0

maxContent==0 implies that a notice text can be infinitely long, but
this value was directly transferred to maxNoticeLength, where 0 was
tested if it was longer than the notice length - which of course always
was false.

This commit fixes the problem for infinite length notices that always
got shortened.
This commit is contained in:
Mikael Nordfeldth
2013-09-25 22:48:32 +02:00
parent e9cc87f5b9
commit 858d9cc3c4
3 changed files with 10 additions and 5 deletions

View File

@@ -1046,7 +1046,7 @@ function common_shorten_links($text, $always = false, User $user=null)
$maxLength = User_urlshortener_prefs::maxNoticeLength($user);
if ($always || mb_strlen($text) > $maxLength) {
if ($always || ($maxLength != -1 && mb_strlen($text) > $maxLength)) {
return common_replace_urls_callback($text, array('File_redirection', 'forceShort'), $user);
} else {
return common_replace_urls_callback($text, array('File_redirection', 'makeShort'), $user);