From: Mikael Nordfeldth Date: Tue, 2 May 2017 07:14:30 +0000 (+0200) Subject: Fix issues with non-subscribed Ostatus_profiles X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e9ab06b59ea29265466130fe732b4a60cf830bec;p=quix0rs-gnu-social.git Fix issues with non-subscribed Ostatus_profiles --- diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index d12881cde4..18e8539eb4 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -1200,6 +1200,22 @@ class OStatusPlugin extends Plugin if ($profile->isLocal()) { return true; } + try { + $oprofile = Ostatus_profile::fromProfile($profile); + } catch (NoResultException $e) { + // Not a remote Ostatus_profile! Maybe some other network + // that has imported a non-local user? + return true; + } + try { + $feedsub = $oprofile->getFeedSub(); + } catch (NoResultException $e) { + // No WebSub subscription has been attempted or exists for this profile + // which is the case, say for remote profiles that are only included + // via mentions or repeat/share. + return true; + } + $websub_states = [ 'subscribe' => _m('Pending'), 'active' => _m('Active'), @@ -1207,8 +1223,6 @@ class OStatusPlugin extends Plugin 'inactive' => _m('Inactive'), ]; $out->elementStart('dl', 'entity_tags ostatus_profile'); - $oprofile = Ostatus_profile::fromProfile($profile); - $feedsub = $oprofile->getFeedSub(); $out->element('dt', null, _m('WebSub')); $out->element('dd', null, $websub_states[$feedsub->sub_state]); $out->elementEnd('dl');