]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
repeat-bug, could not repeat oversized notices
authorHannes Mannerheim <h@nnesmannerhe.im>
Mon, 20 Oct 2014 14:20:12 +0000 (16:20 +0200)
committerHannes Mannerheim <h@nnesmannerhe.im>
Mon, 20 Oct 2014 14:20:12 +0000 (16:20 +0200)
this code is copy-paste from statusnet, apparently we need it still

classes/Notice.php

index b6f480ed5ef2ce9a8860cd0f797bf0e04e97df5f..f2a746a8449ec5f393d5057a44593b2f2a994771 100644 (file)
@@ -2101,6 +2101,18 @@ class Notice extends Managed_DataObject
                            $author->getNickname(),
                            $this->content);
 
+        $maxlen = self::maxContent();
+        if ($maxlen > 0 && mb_strlen($content) > $maxlen) {
+            // Web interface and current Twitter API clients will
+            // pull the original notice's text, but some older
+            // clients and RSS/Atom feeds will see this trimmed text.
+            //
+            // Unfortunately this is likely to lose tags or URLs
+            // at the end of long notices.
+            $content = mb_substr($content, 0, $maxlen - 4) . ' ...';
+        }     
+
+
         // Scope is same as this one's
         return self::saveNew($repeater->id,
                              $content,