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

Commit dc31a3d7 authored by mattl's avatar mattl

Receiving Share activity fixes

Forgot to translate 'self' to 'Ostatus_profile' etc.
parent dcfcceb6
......@@ -98,34 +98,35 @@ class SharePlugin extends ActivityVerbHandlerPlugin
throw new ClientException(_m('Shared activity does not have an id'));
}
// First check if we have the shared activity. This has to be done first, because
// we can't use these functions to "ensureActivityObjectProfile" of a local user,
// who might be the creator of the shared activity in question.
$sharedNotice = Notice::getKV('uri', $sharedId);
if (!$sharedNotice instanceof Notice) {
try {
// First check if we have the shared activity. This has to be done first, because
// we can't use these functions to "ensureActivityObjectProfile" of a local user,
// who might be the creator of the shared activity in question.
$sharedNotice = Notice::getByUri($sharedUri);
} catch (NoResultException $e) {
// If no locally stored notice is found, process it!
// TODO: Remember to check Deleted_notice!
// TODO: If a post is shared that we can't retrieve - what to do?
try {
$other = self::ensureActivityObjectProfile($shared->actor);
$sharedNotice = $other->processActivity($shared, $method);
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.'), $sharedId));
}
} catch (FeedSubException $e) {
// Remote feed could not be found or verified, should we
// transform this into an "RT @user Blah, blah, blah..."?
common_log(LOG_INFO, __METHOD__ . ' got a ' . get_class($e) . ': ' . $e->getMessage());
return null;
$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));
}
} catch (FeedSubException $e) {
// Remote feed could not be found or verified, should we
// transform this into an "RT @user Blah, blah, blah..."?
common_log(LOG_INFO, __METHOD__ . ' got a ' . get_class($e) . ': ' . $e->getMessage());
return false;
}
// We don't have to save a repeat in a separate table, we can
// find repeats by just looking at the notice.repeat_of field.
// By returning true here instead of something that evaluates
// to false, we show that we have processed everything properly.
return true;
}
......
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