]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
Merge branch 'groupalias' into 0.8.x
[quix0rs-gnu-social.git] / classes / Notice.php
index 1c4858149269c6d78a25006cff0b3a3796ec9f49..68602b1f7cbd8e3ac4568043250fac34731bfc4b 100644 (file)
@@ -125,7 +125,12 @@ class Notice extends Memcached_DataObject
 
         $profile = Profile::staticGet($profile_id);
 
-        $final =  common_shorten_links($content);
+        $final = common_shorten_links($content);
+
+        if (mb_strlen($final) > 140) {
+            common_log(LOG_INFO, 'Rejecting notice that is too long.');
+            return _('Problem saving notice. Too long.');
+        }
 
         if (!$profile) {
             common_log(LOG_ERR, 'Problem saving notice. Unknown user.');
@@ -747,16 +752,16 @@ class Notice extends Memcached_DataObject
 
         foreach (array_unique($match[1]) as $nickname) {
             /* XXX: remote groups. */
-            $group = User_group::staticGet('nickname', $nickname);
+            $group = User_group::getForNickname($nickname);
 
-            if (!$group) {
+            if (empty($group)) {
                 continue;
             }
 
             // we automatically add a tag for every group name, too
 
             $tag = Notice_tag::pkeyGet(array('tag' => common_canonical_tag($nickname),
-                                           'notice_id' => $this->id));
+                                             'notice_id' => $this->id));
 
             if (is_null($tag)) {
                 $this->saveTag($nickname);