OStatusPlugin: fix ensureProfile catch-22 in onCheckActivityAuthorship()

Use profile URL (not URI), like elsewhere.

Profile::getUri() doesn't actually do anything useful, here--
it does nothing unless a plugin (like OStatus) is already
able to resolve the Profile into a backend object (e.g.: an Ostatus_profile).

If we might not already have an Ostatus_profile for a given Profile,
then we need to use $profile->getUrl() and fetch the data from that URL.
This commit is contained in:
Joshua Judson Rosen 2014-12-30 23:56:33 -05:00
parent 8056097478
commit f246dd4645

View File

@ -1342,7 +1342,7 @@ class OStatusPlugin extends Plugin
static public function onCheckActivityAuthorship(Activity $activity, Profile &$profile) static public function onCheckActivityAuthorship(Activity $activity, Profile &$profile)
{ {
try { try {
$oprofile = Ostatus_profile::ensureProfileURI($profile->getUri()); $oprofile = Ostatus_profile::ensureProfileURL($profile->getUrl());
$profile = $oprofile->checkAuthorship($activity); $profile = $oprofile->checkAuthorship($activity);
} catch (Exception $e) { } catch (Exception $e) {
common_log(LOG_ERR, 'Could not get a profile or check authorship ('.get_class($e).': "'.$e->getMessage().'") for activity ID: '.$activity->id); common_log(LOG_ERR, 'Could not get a profile or check authorship ('.get_class($e).': "'.$e->getMessage().'") for activity ID: '.$activity->id);