Removed unused code from the profile sidebar
This commit is contained in:
parent
afe3c8954c
commit
c17e1d7e0b
1 changed files with 11 additions and 37 deletions
|
@ -287,45 +287,25 @@ class Profile
|
||||||
// correct contact table entry for the logged-in user.
|
// correct contact table entry for the logged-in user.
|
||||||
$profile_contact = [];
|
$profile_contact = [];
|
||||||
|
|
||||||
if (!empty($profile['nurl'])) {
|
|
||||||
if (local_user() && ($profile['uid'] ?? 0) != local_user()) {
|
if (local_user() && ($profile['uid'] ?? 0) != local_user()) {
|
||||||
$profile_contact = Contact::getByURL($profile['nurl'], null, ['rel'], local_user());
|
$profile_contact = Contact::getByURL($profile['nurl'], null, [], local_user());
|
||||||
}
|
}
|
||||||
if (!empty($profile['cid']) && self::getMyURL()) {
|
if (!empty($profile['cid']) && self::getMyURL()) {
|
||||||
$profile_contact = Contact::selectFirst(['rel'], ['id' => $profile['cid']]);
|
$profile_contact = Contact::selectFirst([], ['id' => $profile['cid']]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($profile['nickname'])) {
|
$profile['picdate'] = urlencode($profile['picdate']);
|
||||||
Logger::warning('Received profile with no nickname', ['profile' => $profile, 'callstack' => System::callstack(10)]);
|
|
||||||
return $o;
|
|
||||||
}
|
|
||||||
|
|
||||||
$profile['picdate'] = urlencode($profile['picdate'] ?? '');
|
|
||||||
|
|
||||||
if (($profile['network'] != '') && ($profile['network'] != Protocol::DFRN)) {
|
|
||||||
$profile['network_link'] = Strings::formatNetworkName($profile['network'], $profile['url']);
|
|
||||||
} else {
|
|
||||||
$profile['network_link'] = '';
|
$profile['network_link'] = '';
|
||||||
}
|
|
||||||
|
|
||||||
Hook::callAll('profile_sidebar_enter', $profile);
|
Hook::callAll('profile_sidebar_enter', $profile);
|
||||||
|
|
||||||
if (isset($profile['url'])) {
|
|
||||||
$profile_url = $profile['url'];
|
$profile_url = $profile['url'];
|
||||||
} else {
|
|
||||||
$profile_url = DI::baseUrl()->get() . '/profile/' . $profile['nickname'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($profile['id'])) {
|
|
||||||
$cid = $profile['id'];
|
$cid = $profile['id'];
|
||||||
} else {
|
|
||||||
$cid = Contact::getIdForURL($profile_url, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$follow_link = null;
|
$follow_link = null;
|
||||||
$unfollow_link = null;
|
$unfollow_link = null;
|
||||||
$subscribe_feed_link = null;
|
|
||||||
$wallmessage_link = null;
|
$wallmessage_link = null;
|
||||||
|
|
||||||
// Who is the logged-in user to this profile?
|
// Who is the logged-in user to this profile?
|
||||||
|
@ -334,8 +314,6 @@ class Profile
|
||||||
$visitor_contact = Contact::selectFirst(['rel'], ['uid' => $profile['uid'], 'nurl' => Strings::normaliseLink(self::getMyURL())]);
|
$visitor_contact = Contact::selectFirst(['rel'], ['uid' => $profile['uid'], 'nurl' => Strings::normaliseLink(self::getMyURL())]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile_is_dfrn = $profile['network'] == Protocol::DFRN;
|
|
||||||
$profile_is_native = in_array($profile['network'], Protocol::NATIVE_SUPPORT);
|
|
||||||
$local_user_is_self = self::getMyURL() && ($profile['url'] == self::getMyURL());
|
$local_user_is_self = self::getMyURL() && ($profile['url'] == self::getMyURL());
|
||||||
$visitor_is_authenticated = (bool)self::getMyURL();
|
$visitor_is_authenticated = (bool)self::getMyURL();
|
||||||
$visitor_is_following =
|
$visitor_is_following =
|
||||||
|
@ -352,7 +330,7 @@ class Profile
|
||||||
if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()->get()) === 0) {
|
if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()->get()) === 0) {
|
||||||
$follow_link = 'remote_follow/' . $profile['nickname'];
|
$follow_link = 'remote_follow/' . $profile['nickname'];
|
||||||
}
|
}
|
||||||
} elseif ($profile_is_native) {
|
} else {
|
||||||
if ($visitor_is_following) {
|
if ($visitor_is_following) {
|
||||||
$unfollow_link = $visitor_base_path . '/unfollow?url=' . urlencode($profile_url) . '&auto=1';
|
$unfollow_link = $visitor_base_path . '/unfollow?url=' . urlencode($profile_url) . '&auto=1';
|
||||||
} else {
|
} else {
|
||||||
|
@ -360,10 +338,6 @@ class Profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($profile_is_dfrn) {
|
|
||||||
$subscribe_feed_link = 'dfrn_poll/' . $profile['nickname'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Contact::canReceivePrivateMessages($profile_contact)) {
|
if (Contact::canReceivePrivateMessages($profile_contact)) {
|
||||||
if ($visitor_is_followed || $visitor_is_following) {
|
if ($visitor_is_followed || $visitor_is_following) {
|
||||||
$wallmessage_link = $visitor_base_path . '/message/new/' . $profile_contact['id'];
|
$wallmessage_link = $visitor_base_path . '/message/new/' . $profile_contact['id'];
|
||||||
|
@ -478,7 +452,7 @@ class Profile
|
||||||
'$unfollow' => DI::l10n()->t('Unfollow'),
|
'$unfollow' => DI::l10n()->t('Unfollow'),
|
||||||
'$unfollow_link' => $unfollow_link,
|
'$unfollow_link' => $unfollow_link,
|
||||||
'$subscribe_feed' => DI::l10n()->t('Atom feed'),
|
'$subscribe_feed' => DI::l10n()->t('Atom feed'),
|
||||||
'$subscribe_feed_link' => $subscribe_feed_link,
|
'$subscribe_feed_link' => $profile['poll'],
|
||||||
'$wallmessage' => DI::l10n()->t('Message'),
|
'$wallmessage' => DI::l10n()->t('Message'),
|
||||||
'$wallmessage_link' => $wallmessage_link,
|
'$wallmessage_link' => $wallmessage_link,
|
||||||
'$account_type' => $account_type,
|
'$account_type' => $account_type,
|
||||||
|
|
Loading…
Reference in a new issue