We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 05118003 authored by Brion Vibber's avatar Brion Vibber

Provisional tweak for polls to go through atom feeds / ostatus

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.
parent 2567474d
...@@ -308,8 +308,9 @@ abstract class MicroAppPlugin extends Plugin ...@@ -308,8 +308,9 @@ abstract class MicroAppPlugin extends Plugin
'url' => $object->link, 'url' => $object->link,
'is_local' => Notice::REMOTE_OMB, 'is_local' => Notice::REMOTE_OMB,
'source' => 'ostatus'); 'source' => 'ostatus');
$this->saveNoticeFromActivity($activity, $actor); // $actor is an ostatus_profile
$this->saveNoticeFromActivity($activity, $actor->localProfile());
return false; return false;
} }
...@@ -365,7 +366,8 @@ abstract class MicroAppPlugin extends Plugin ...@@ -365,7 +366,8 @@ abstract class MicroAppPlugin extends Plugin
'is_local' => Notice::REMOTE_OMB, 'is_local' => Notice::REMOTE_OMB,
'source' => 'ostatus'); 'source' => 'ostatus');
$this->saveNoticeFromActivity($activity, $actor, $options); // $actor is an ostatus_profile
$this->saveNoticeFromActivity($activity, $actor->localProfile(), $options);
return false; return false;
} }
...@@ -389,6 +391,7 @@ abstract class MicroAppPlugin extends Plugin ...@@ -389,6 +391,7 @@ abstract class MicroAppPlugin extends Plugin
$options = array('source' => 'atompub'); $options = array('source' => 'atompub');
// $user->getProfile() is a Profile
$this->saveNoticeFromActivity($activity, $this->saveNoticeFromActivity($activity,
$user->getProfile(), $user->getProfile(),
$options); $options);
...@@ -421,6 +424,7 @@ abstract class MicroAppPlugin extends Plugin ...@@ -421,6 +424,7 @@ abstract class MicroAppPlugin extends Plugin
'url' => $object->link, 'url' => $object->link,
'source' => 'restore'); 'source' => 'restore');
// $user->getProfile() is a Profile
$saved = $this->saveNoticeFromActivity($activity, $saved = $this->saveNoticeFromActivity($activity,
$user->getProfile(), $user->getProfile(),
$options); $options);
......
...@@ -194,6 +194,7 @@ class PollPlugin extends MicroAppPlugin ...@@ -194,6 +194,7 @@ class PollPlugin extends MicroAppPlugin
{ {
// @fixme // @fixme
common_log(LOG_DEBUG, "XXX activity: " . var_export($activity, true)); 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)); common_log(LOG_DEBUG, "XXX options: " . var_export($options, true));
// Ok for now, we can grab stuff from the XML entry directly. // Ok for now, we can grab stuff from the XML entry directly.
...@@ -215,6 +216,13 @@ class PollPlugin extends MicroAppPlugin ...@@ -215,6 +216,13 @@ class PollPlugin extends MicroAppPlugin
} }
common_log(LOG_DEBUG, "YYY question: $question"); common_log(LOG_DEBUG, "YYY question: $question");
common_log(LOG_DEBUG, "YYY opts: " . var_export($opts, true)); 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 { } else {
common_log(LOG_DEBUG, "YYY no poll data"); common_log(LOG_DEBUG, "YYY no poll data");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment