X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FShare%2FSharePlugin.php;h=1f6ddbaa3fb723dea736748bb2217ff7247f83b1;hb=38c84a92c71913fff570b64d21b7d2e07dfa3dd3;hp=c31686e4451b5556c2488ce24c7dbe41b4d812a0;hpb=f513ceac7d80d31a2ba32a7813df869a9ecc1c3e;p=quix0rs-gnu-social.git diff --git a/plugins/Share/SharePlugin.php b/plugins/Share/SharePlugin.php index c31686e445..1f6ddbaa3f 100644 --- a/plugins/Share/SharePlugin.php +++ b/plugins/Share/SharePlugin.php @@ -116,13 +116,7 @@ class SharePlugin extends ActivityVerbHandlerPlugin // TODO: Remember to check Deleted_notice! // TODO: If a post is shared that we can't retrieve - what to do? $other = Ostatus_profile::ensureActivityObjectProfile($shared->actor); - $sharedNotice = $other->processActivity($shared, 'push'); // FIXME: push/salmon/what? - if (!$sharedNotice instanceof Notice) { - // And if we apparently can't get the shared notice, we'll abort the whole thing. - // TRANS: Client exception thrown when saving an activity share fails. - // TRANS: %s is a share ID. - throw new ClientException(sprintf(_m('Failed to save activity %s.'), $sharedUri)); - } + $sharedNotice = Notice::saveActivity($shared, $other->localProfile(), array('source'=>'share')); } catch (FeedSubException $e) { // Remote feed could not be found or verified, should we // transform this into an "RT @user Blah, blah, blah..."? @@ -170,14 +164,15 @@ class SharePlugin extends ActivityVerbHandlerPlugin $act->objects[] = $target->asActivity($scoped); } - public function activityObjectFromNotice(Notice $notice) + public function activityObjectFromNotice(Notice $stored) { // Repeat is a little bit special. As it's an activity, our // ActivityObject is instead turned into an Activity $object = new Activity(); + $object->actor = $stored->getProfile()->asActivityObject(); $object->verb = ActivityVerb::SHARE; - $object->content = $notice->rendered; - $this->extendActivity($stored, $act); + $object->content = $stored->rendered; + $this->extendActivity($stored, $object); return $object; } @@ -236,8 +231,9 @@ class SharePlugin extends ActivityVerbHandlerPlugin public function onEndShowNoticeOptionItems($nli) { // FIXME: Use bitmasks (but be aware that PUBLIC_SCOPE is 0!) - if ($nli->notice->scope == Notice::PUBLIC_SCOPE || - $nli->notice->scope == Notice::SITE_SCOPE) { + // Also: AHHH, $scope and $scoped are scarily similar looking. + $scope = $nli->notice->getScope(); + if ($scope === Notice::PUBLIC_SCOPE || $scope === Notice::SITE_SCOPE) { $scoped = Profile::current(); if ($scoped instanceof Profile && $scoped->getID() !== $nli->notice->getProfile()->getID()) { @@ -256,7 +252,7 @@ class SharePlugin extends ActivityVerbHandlerPlugin } } - public function showNoticeListItem(NoticeListItem $nli) + protected function showNoticeListItem(NoticeListItem $nli) { // pass }