From b00bcbb1c150246731822f0e22c1ba80000ff027 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 10 Jun 2019 21:40:44 -0400 Subject: [PATCH] Normalize the contact sidebar with the profile sidebar - Remove un/follow text links in contact status window --- src/Module/Contact.php | 38 +++++++++++++--------- view/templates/contact_edit.tpl | 5 --- view/templates/widget/vcard.tpl | 15 +++++++++ view/theme/frio/templates/contact_edit.tpl | 5 --- view/theme/frio/templates/widget/vcard.tpl | 25 ++++++++++++++ view/theme/vier/templates/contact_edit.tpl | 5 --- 6 files changed, 62 insertions(+), 31 deletions(-) diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 989896ef7..feae601fd 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -309,6 +309,21 @@ class Contact extends BaseModule $network_link = ''; } + $follow_link = ''; + $unfollow_link = ''; + if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) { + if ($contact['uid'] && in_array($contact['rel'], [Model\Contact::SHARING, Model\Contact::FRIEND])) { + $unfollow_link = 'unfollow?url=' . urlencode($contact['url']); + } elseif(!$contact['pending']) { + $follow_link = 'follow?url=' . urlencode($contact['url']); + } + } + + $wallmessage_link = ''; + if ($contact['uid'] && Model\Contact::canReceivePrivateMessages($contact)) { + $wallmessage_link = 'message/new/' . $contact['id']; + } + $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [ '$name' => $contact['name'], '$photo' => $contact['photo'], @@ -316,7 +331,13 @@ class Contact extends BaseModule '$addr' => defaults($contact, 'addr', ''), '$network_link' => $network_link, '$network' => L10n::t('Network:'), - '$account_type' => Model\Contact::getAccountType($contact) + '$account_type' => Model\Contact::getAccountType($contact), + '$follow' => L10n::t('Follow'), + '$follow_link' => $follow_link, + '$unfollow' => L10n::t('Unfollow'), + '$unfollow_link' => $unfollow_link, + '$wallmessage' => L10n::t('Message'), + '$wallmessage_link' => $wallmessage_link, ]); $findpeople_widget = ''; @@ -557,19 +578,6 @@ class Contact extends BaseModule $profile_select = ContactSelector::profileAssign($contact['profile-id'], $contact['network'] !== Protocol::DFRN); } - /// @todo Only show the following link with DFRN when the remote version supports it - $follow = ''; - $follow_text = ''; - if ($contact['uid'] && in_array($contact['rel'], [Model\Contact::FRIEND, Model\Contact::SHARING])) { - if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) { - $follow = $a->getBaseURL(true) . '/unfollow?url=' . urlencode($contact['url']); - $follow_text = L10n::t('Disconnect/Unfollow'); - } - } elseif(!$contact['pending']) { - $follow = $a->getBaseURL(true) . '/follow?url=' . urlencode($contact['url']); - $follow_text = L10n::t('Connect/Follow'); - } - // Load contactact related actions like hide, suggest, delete and others $contact_actions = self::getContactActions($contact); @@ -610,8 +618,6 @@ class Contact extends BaseModule '$updpub' => L10n::t('Update public posts'), '$last_update' => $last_update, '$udnow' => L10n::t('Update now'), - '$follow' => $follow, - '$follow_text' => $follow_text, '$profile_select' => $profile_select, '$contact_id' => $contact['id'], '$block_text' => ($contact['blocked'] ? L10n::t('Unblock') : L10n::t('Block')), diff --git a/view/templates/contact_edit.tpl b/view/templates/contact_edit.tpl index 644121cad..d78d4162e 100644 --- a/view/templates/contact_edit.tpl +++ b/view/templates/contact_edit.tpl @@ -44,11 +44,6 @@ {{if $ignored}}
  • {{$ignored}}
  • {{/if}} {{if $archived}}
  • {{$archived}}
  • {{/if}} - - {{* End of contact-edit-status-wrapper *}} {{* Some information about the contact from the profile *}} diff --git a/view/templates/widget/vcard.tpl b/view/templates/widget/vcard.tpl index 240466460..465d206b8 100644 --- a/view/templates/widget/vcard.tpl +++ b/view/templates/widget/vcard.tpl @@ -10,5 +10,20 @@ {{/if}} {{if $account_type}}
    {{$account_type}}
    {{/if}} {{if $network_link}}
    {{$network}}
    {{$network_link nofilter}}
    {{/if}} + + +
    diff --git a/view/theme/frio/templates/contact_edit.tpl b/view/theme/frio/templates/contact_edit.tpl index 92ff615a9..f9454dc65 100644 --- a/view/theme/frio/templates/contact_edit.tpl +++ b/view/theme/frio/templates/contact_edit.tpl @@ -58,11 +58,6 @@ {{if $ignored}}
  • {{$ignored}}
  • {{/if}} {{if $archived}}
  • {{$archived}}
  • {{/if}} - - {{* End of contact-edit-status-wrapper *}} diff --git a/view/theme/frio/templates/widget/vcard.tpl b/view/theme/frio/templates/widget/vcard.tpl index d1b41728b..366c570a7 100644 --- a/view/theme/frio/templates/widget/vcard.tpl +++ b/view/theme/frio/templates/widget/vcard.tpl @@ -34,5 +34,30 @@ {{if $network_link}}
    {{$network}}
    {{$network_link nofilter}}
    {{/if}} + + diff --git a/view/theme/vier/templates/contact_edit.tpl b/view/theme/vier/templates/contact_edit.tpl index a01fac9ee..bd07f1821 100644 --- a/view/theme/vier/templates/contact_edit.tpl +++ b/view/theme/vier/templates/contact_edit.tpl @@ -45,11 +45,6 @@ {{if $ignored}}
  • {{$ignored}}
  • {{/if}} {{if $archived}}
  • {{$archived}}
  • {{/if}} - - {{* End of contact-edit-status-wrapper *}} {{* Some information about the contact from the profile *}}