]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Bookmark/newbookmark.php
Fix a todo wrt plural support.
[quix0rs-gnu-social.git] / plugins / Bookmark / newbookmark.php
index 92e9bc81c59a3ee77106f7a1383fb11969e378f9..d60d3d4670caab9b70be04257e7f8fa96abea0d7 100644 (file)
@@ -75,6 +75,10 @@ class NewbookmarkAction extends Action
     {
         parent::prepare($argarray);
 
+        if ($this->boolean('ajax')) {
+            StatusNet::setApi(true);
+        }
+
         $this->user = common_current_user();
 
         if (empty($this->user)) {
@@ -122,9 +126,6 @@ class NewbookmarkAction extends Action
      */
     function newBookmark()
     {
-        if ($this->boolean('ajax')) {
-            StatusNet::setApi(true);
-        }
         try {
             if (empty($this->title)) {
                 // TRANS: Client exception thrown when trying to create a new bookmark without a title.
@@ -148,9 +149,13 @@ class NewbookmarkAction extends Action
                                        $options);
 
         } catch (ClientException $ce) {
-            $this->error = $ce->getMessage();
-            $this->showPage();
-            return;
+            if ($this->boolean('ajax')) {
+                throw $ce;
+            } else {
+                $this->error = $ce->getMessage();
+                $this->showPage();
+                return;
+            }
         }
 
         if ($this->boolean('ajax')) {