]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Duplicate URI means we have it already, I assume
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 27 Dec 2015 00:40:00 +0000 (01:40 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 27 Dec 2015 00:40:00 +0000 (01:40 +0100)
classes/Notice.php
plugins/OStatus/actions/groupsalmon.php
plugins/OStatus/actions/usersalmon.php

index 6fe2e4c76ad6e9dfee40f509932792dc13f9a499..c5c07e6d19cabd3c93b288d18d7b519969aa959b 100644 (file)
@@ -780,7 +780,9 @@ class Notice extends Managed_DataObject
             $stored->uri = $uri;
             if ($stored->find()) {
                 common_debug('cannot create duplicate Notice URI: '.$stored->uri);
-                throw new Exception('Notice URI already exists');
+                // I _assume_ saving a Notice with a colliding URI means we're really trying to
+                // save the same notice again...
+                throw new AlreadyFulfilledException('Notice URI already exists');
             }
         }
 
index a255a3d022999d8d6bc67108a46bcee362eeaca5..ee82e627d478bf7a89f76843016ba7b105a0e642 100644 (file)
@@ -88,7 +88,11 @@ class GroupsalmonAction extends SalmonAction
             }
         }
 
-        $this->saveNotice();
+        try {
+            $this->saveNotice();
+        } catch AlreadyFulfilledException($e) {
+            return;
+        }
     }
 
     /**
index 7fce6c808c5118fba49450ce95049fd4973cd2c1..c62556786001a95f3387c72e925ad40d726da97c 100644 (file)
@@ -95,13 +95,11 @@ class UsersalmonAction extends SalmonAction
             throw new ClientException(_m('Not to anyone in reply to anything.'));
         }
 
-        $existing = Notice::getKV('uri', $this->activity->objects[0]->id);
-        if ($existing instanceof Notice) {
-            common_log(LOG_ERR, "Not saving notice with duplicate URI '".$existing->getUri()."' (seems it already exists).");
+        try {
+            $this->saveNotice();
+        } catch AlreadyFulfilledException($e) {
             return;
         }
-
-        $this->saveNotice();
     }
 
     /**