]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Minor improvements on Notice::saveActivity
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 18 Jan 2016 18:29:45 +0000 (19:29 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 18 Jan 2016 18:29:45 +0000 (19:29 +0100)
classes/Notice.php

index 0fefb9b48a0fecfc1bb206794438bc913abd2679..7524b9ff693a928f1ea8c5ca0f3c751411dce08c 100644 (file)
@@ -754,7 +754,7 @@ class Notice extends Managed_DataObject
             $options['uri'] = $act->id;
             $options['url'] = $act->link;
         } else {
-            $actobj = count($act->objects)==1 ? $act->objects[0] : null;
+            $actobj = count($act->objects)===1 ? $act->objects[0] : null;
             if (!is_null($actobj) && !empty($actobj->id)) {
                 $options['uri'] = $actobj->id;
                 if ($actobj->link) {
@@ -835,6 +835,10 @@ class Notice extends Managed_DataObject
         $stored->rendered = $actor->isLocal() ? $content : common_purify($content);
         // yeah, just don't use getRendered() here since it's not inserted yet ;)
         $stored->content = common_strip_html($stored->rendered);
+        if (trim($stored->content) === '') {
+            // TRANS: Error message when the plain text content of a notice has zero length.
+            throw new ClientException(_('Empty notice content, will not save this.'));
+        }
 
         // Maybe a missing act-time should be fatal if the actor is not local?
         if (!empty($act->time)) {