]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Start using NoParentNoticeException more widely
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 2 Jun 2015 11:50:52 +0000 (13:50 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 2 Jun 2015 11:50:52 +0000 (13:50 +0200)
classes/Notice.php
lib/apiaction.php
lib/implugin.php
lib/util.php
plugins/Xmpp/XmppPlugin.php

index 4d57c5a8db4952c2cb9cadadde2ececa8cb4038a..49c6801ae77f418799b30acd08b479f3b7ca10de 100644 (file)
@@ -1311,7 +1311,7 @@ class Notice extends Managed_DataObject
                     $last = $parent;
                     continue;
                 }
-            } catch (Exception $e) {
+            } catch (NoParentNoticeException $e) {
                 // Latest notice has no parent
             }
             // No parent, or parent out of scope
@@ -1617,7 +1617,7 @@ class Notice extends Managed_DataObject
             $this->saveReply($parentauthor->id);
             $replied[$parentauthor->id] = 1;
             self::blow('reply:stream:%d', $parentauthor->id);
-        } catch (Exception $e) {
+        } catch (NoParentNoticeException $e) {
             // Not a reply, since it has no parent!
         }
 
@@ -1852,7 +1852,7 @@ class Notice extends Managed_DataObject
                 $reply = $this->getParent();
                 $ctx->replyToID  = $reply->getUri();
                 $ctx->replyToUrl = $reply->getUrl();
-            } catch (Exception $e) {
+            } catch (NoParentNoticeException $e) {
                 // This is not a reply to something
             }
 
index 0eea08bed63f147a4c05b1edaec6fbfc68793cd2..724447f120cbadc7df1c66bd09ee095d597ba0fb 100755 (executable)
@@ -328,7 +328,7 @@ class ApiAction extends Action
             // different story for parenting.
             $parent = $notice->getParent();
             $in_reply_to = $parent->id;
-        } catch (Exception $e) {
+        } catch (NoParentNoticeException $e) {
             $in_reply_to = null;
         }
         $twitter_status['in_reply_to_status_id'] = $in_reply_to;
index 5b0f3dbe092fa42dbd73d01dc3e727392151d1bb..98fba19911ebe8d8ffac6162089fe7c664e4bc4b 100644 (file)
@@ -380,7 +380,7 @@ abstract class ImPlugin extends Plugin
             $parent = $notice->getParent();
             $orig_profile = $parent->getProfile();
             $nicknames = sprintf('%1$s => %2$s', $profile->nickname, $orig_profile->nickname);
-        } catch (Exception $e) {
+        } catch (NoParentNoticeException $e) {
             $nicknames = $profile->nickname;
         }
 
index 395fadfbd7bcf35010ccaa993bbdee9de51e832f..f29d9559b9b7af119a2c1499b5201b1e951cf7d6 100644 (file)
@@ -725,8 +725,8 @@ function common_find_mentions($text, Notice $notice)
                 }
             } catch (NoProfileException $e) {
                 common_log(LOG_WARNING, sprintf('Notice %d author profile id %d does not exist', $origNotice->id, $origNotice->profile_id));
-            } catch (ServerException $e) {
-                // Probably just no parent. Should get a specific NoParentException
+            } catch (NoParentNoticeException $e) {
+                // This notice is not in reply to anything
             } catch (Exception $e) {
                 common_log(LOG_WARNING, __METHOD__ . ' got exception ' . get_class($e) . ' : ' . $e->getMessage());
             }
index 2974e8b2ab40e29ed30f0371652f2751868a65c1..d95ffcf0d6d0d2bd636546b276b5ace8407a49eb 100644 (file)
@@ -354,7 +354,7 @@ class XmppPlugin extends ImPlugin
             $xs->text(": ");
         } catch (InvalidUrlException $e) {
             $xs->text(sprintf(' => %s', $orig_profile->nickname));
-        } catch (Exception $e) {
+        } catch (NoParentNoticeException $e) {
             $xs->text(": ");
         }
         if (!empty($notice->rendered)) {