]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Provisional tweak for polls to go through atom feeds / ostatus
authorBrion Vibber <brion@pobox.com>
Thu, 10 Mar 2011 19:35:04 +0000 (11:35 -0800)
committerBrion Vibber <brion@pobox.com>
Thu, 10 Mar 2011 19:35:04 +0000 (11:35 -0800)
Had to fix some calls to MicroAppPlugin->saveNoticeFromActivity() which passed an OStatus_profile instead of a Profile...
Imported polls don't get data from upstream or send it back currently.

lib/microappplugin.php
plugins/Poll/PollPlugin.php

index 93b70a03242b6f99cded929715131965e3f3ab65..7e8a124d1e57a6809ec60288411ec5bfac61499e 100644 (file)
@@ -308,8 +308,9 @@ abstract class MicroAppPlugin extends Plugin
                              'url' => $object->link,
                              'is_local' => Notice::REMOTE_OMB,
                              'source' => 'ostatus');
-            
-            $this->saveNoticeFromActivity($activity, $actor);
+
+            // $actor is an ostatus_profile
+            $this->saveNoticeFromActivity($activity, $actor->localProfile());
 
             return false;
         }
@@ -365,7 +366,8 @@ abstract class MicroAppPlugin extends Plugin
                              'is_local' => Notice::REMOTE_OMB,
                              'source' => 'ostatus');
 
-            $this->saveNoticeFromActivity($activity, $actor, $options);
+            // $actor is an ostatus_profile
+            $this->saveNoticeFromActivity($activity, $actor->localProfile(), $options);
 
             return false;
         }
@@ -389,6 +391,7 @@ abstract class MicroAppPlugin extends Plugin
 
             $options = array('source' => 'atompub');
 
+            // $user->getProfile() is a Profile
             $this->saveNoticeFromActivity($activity,
                                           $user->getProfile(),
                                           $options);
@@ -421,6 +424,7 @@ abstract class MicroAppPlugin extends Plugin
                              'url' => $object->link,
                              'source' => 'restore');
 
+            // $user->getProfile() is a Profile
             $saved = $this->saveNoticeFromActivity($activity,
                                                    $user->getProfile(),
                                                    $options);
index 193b0b17a2fece8646f3279366a8fa2788946fa0..8a69ccd225b4f37856f910f493cc164c4bee935b 100644 (file)
@@ -194,6 +194,7 @@ class PollPlugin extends MicroAppPlugin
     {
         // @fixme
         common_log(LOG_DEBUG, "XXX activity: " . var_export($activity, true));
+        common_log(LOG_DEBUG, "XXX profile: " . var_export($profile, true));
         common_log(LOG_DEBUG, "XXX options: " . var_export($options, true));
 
         // Ok for now, we can grab stuff from the XML entry directly.
@@ -215,6 +216,13 @@ class PollPlugin extends MicroAppPlugin
                 }
                 common_log(LOG_DEBUG, "YYY question: $question");
                 common_log(LOG_DEBUG, "YYY opts: " . var_export($opts, true));
+                try {
+                    $notice = Poll::saveNew($profile, $question, $opts, $options);
+                    common_log(LOG_DEBUG, "YYY ok: " . $notice->id);
+                    return $notice;
+                } catch (Exception $e) {
+                    common_log(LOG_DEBUG, "YYY fail: " . $e->getMessage());
+                }
             } else {
                 common_log(LOG_DEBUG, "YYY no poll data");
             }