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

Commit 38bea345 authored by mattl's avatar mattl

Moved functions into ActivityHandlerPlugin from MicroAppPlugin

Dummy functions in Favorite plugin so far
parent d0da5527
This diff is collapsed.
This diff is collapsed.
......@@ -112,7 +112,7 @@ class BlogPlugin extends MicroAppPlugin
return array(Blog_entry::TYPE);
}
function saveNoticeFromActivity($activity, $actor, $options=array())
function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
{
if (count($activity->objects) != 1) {
// TRANS: Exception thrown when there are too many activity objects.
......@@ -143,7 +143,7 @@ class BlogPlugin extends MicroAppPlugin
return $notice;
}
function activityObjectFromNotice($notice)
function activityObjectFromNotice(Notice $notice)
{
$entry = Blog_entry::fromNotice($notice);
......@@ -161,7 +161,7 @@ class BlogPlugin extends MicroAppPlugin
return new BlogEntryForm($out);
}
function deleteRelated($notice)
function deleteRelated(Notice $notice)
{
if ($notice->object_type == Blog_entry::TYPE) {
$entry = Blog_entry::fromNotice($notice);
......
......@@ -309,7 +309,7 @@ class BookmarkPlugin extends MicroAppPlugin
*
* @return boolean hook value
*/
function deleteRelated($notice)
function deleteRelated(Notice $notice)
{
if ($this->isMyNotice($notice)) {
......@@ -327,12 +327,12 @@ class BookmarkPlugin extends MicroAppPlugin
* Save a bookmark from an activity
*
* @param Activity $activity Activity to save
* @param Profile $profile Profile to use as author
* @param Profile $actor Profile to use as author
* @param array $options Options to pass to bookmark-saving code
*
* @return Notice resulting notice
*/
function saveNoticeFromActivity($activity, $profile, $options=array())
function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
{
$bookmark = $activity->objects[0];
......@@ -403,7 +403,7 @@ class BookmarkPlugin extends MicroAppPlugin
}
}
return Bookmark::saveNew($profile,
return Bookmark::saveNew($actor,
$bookmark->title,
$url,
$tags,
......@@ -411,7 +411,7 @@ class BookmarkPlugin extends MicroAppPlugin
$options);
}
function activityObjectFromNotice($notice)
function activityObjectFromNotice(Notice $notice)
{
assert($this->isMyNotice($notice));
......
......@@ -128,7 +128,7 @@ class EventPlugin extends MicroappPlugin
*
* @return Notice the resulting notice
*/
function saveNoticeFromActivity($activity, $actor, $options=array())
function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
{
if (count($activity->objects) != 1) {
// TRANS: Exception thrown when there are too many activity objects.
......@@ -182,7 +182,7 @@ class EventPlugin extends MicroappPlugin
*
* @return ActivityObject
*/
function activityObjectFromNotice($notice)
function activityObjectFromNotice(Notice $notice)
{
$happening = null;
......@@ -288,7 +288,7 @@ class EventPlugin extends MicroappPlugin
*
* @param Notice $notice
*/
function deleteRelated($notice)
function deleteRelated(Notice $notice)
{
switch ($notice->object_type) {
case Happening::OBJECT_TYPE:
......
......@@ -147,6 +147,20 @@ class FavoritePlugin extends ActivityHandlerPlugin
'format' => '(xml|json)'));
}
public function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
{
}
public function activityObjectFromNotice(Notice $notice)
{
}
public function deleteRelated(Notice $notice)
{
}
// API stuff
/**
* Typically just used to fill out Twitter-compatible API status data.
*
......@@ -180,6 +194,11 @@ class FavoritePlugin extends ActivityHandlerPlugin
public function onNoticeDeleteRelated(Notice $notice)
{
parent::onNoticeDeleteRelated($notice);
// The below algorithm is because we have faves not stored as
// proper activities in Notice from legacy versions of SN/GNU social
$fave = new Fave();
$fave->notice_id = $notice->id;
......
......@@ -69,7 +69,7 @@ class GNUsocialPhotoPlugin extends MicroAppPlugin
return array(Photo::OBJECT_TYPE);
}
function saveNoticeFromActivity($activity, $actor, $options=array())
function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
{
if(count($activity->objects) != 1) {
......@@ -97,7 +97,7 @@ class GNUsocialPhotoPlugin extends MicroAppPlugin
}
function activityObjectFromNotice($notice)
function activityObjectFromNotice(Notice $notice)
{
$photo = Photo::getByNotice($notice);
......@@ -132,7 +132,7 @@ class GNUsocialPhotoPlugin extends MicroAppPlugin
}
}
function deleteRelated($notice)
function deleteRelated(Notice $notice)
{
$photo = Photo::getByNotice($notice);
if ($photo) {
......
......@@ -69,7 +69,7 @@ class GNUsocialVideoPlugin extends MicroAppPlugin
return array(Video::OBJECT_TYPE);
}
function saveNoticeFromActivity($activity, $actor, $options=array())
function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
{
if(count($activity->objects) != 1) {
throw new Exception('Too many activity objects.');
......@@ -91,7 +91,7 @@ class GNUsocialVideoPlugin extends MicroAppPlugin
}
function activityObjectFromNotice($notice)
function activityObjectFromNotice(Notice $notice)
{
$object = new ActivityObject();
$object->id = $notice->uri;
......@@ -120,7 +120,7 @@ class GNUsocialVideoPlugin extends MicroAppPlugin
}
}
function deleteRelated($notice)
function deleteRelated(Notice $notice)
{
$vid = Video::getByNotice($notice);
if ($vid) {
......
......@@ -142,7 +142,7 @@ class PollPlugin extends MicroAppPlugin
*
* @return boolean hook value
*/
function deleteRelated($notice)
function deleteRelated(Notice $notice)
{
$p = Poll::getByNotice($notice);
......@@ -162,7 +162,7 @@ class PollPlugin extends MicroAppPlugin
*
* @return Notice resulting notice
*/
function saveNoticeFromActivity($activity, $profile, $options=array())
function saveNoticeFromActivity(Activity $activity, Profile $profile, array $options=array())
{
// @fixme
common_log(LOG_DEBUG, "XXX activity: " . var_export($activity, true));
......@@ -219,7 +219,7 @@ class PollPlugin extends MicroAppPlugin
}
}
function activityObjectFromNotice($notice)
function activityObjectFromNotice(Notice $notice)
{
assert($this->isMyNotice($notice));
......@@ -235,7 +235,7 @@ class PollPlugin extends MicroAppPlugin
}
}
function activityObjectFromNoticePollResponse($notice)
function activityObjectFromNoticePollResponse(Notice $notice)
{
$object = new ActivityObject();
$object->id = $notice->uri;
......@@ -258,7 +258,7 @@ class PollPlugin extends MicroAppPlugin
return $object;
}
function activityObjectFromNoticePoll($notice)
function activityObjectFromNoticePoll(Notice $notice)
{
$object = new ActivityObject();
$object->id = $notice->uri;
......
......@@ -161,7 +161,7 @@ class QnAPlugin extends MicroAppPlugin
*
* @return Notice the resulting notice
*/
function saveNoticeFromActivity($activity, $actor, $options=array())
function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
{
if (count($activity->objects) != 1) {
// TRANS: Exception thrown when there are too many activity objects.
......@@ -211,7 +211,7 @@ class QnAPlugin extends MicroAppPlugin
* @return ActivityObject
*/
function activityObjectFromNotice($notice)
function activityObjectFromNotice(Notice $notice)
{
$question = null;
......@@ -492,7 +492,7 @@ class QnAPlugin extends MicroAppPlugin
*
* @param Notice $notice
*/
function deleteRelated($notice)
function deleteRelated(Notice $notice)
{
switch ($notice->object_type) {
case QnA_Question::OBJECT_TYPE:
......
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