Normalize the contact sidebar with the profile sidebar

- Remove un/follow text links in contact status window
This commit is contained in:
Hypolite Petovan 2019-06-10 21:40:44 -04:00
parent 3aebb92cf3
commit b00bcbb1c1
6 changed files with 62 additions and 31 deletions

View file

@ -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')),

View file

@ -44,11 +44,6 @@
{{if $ignored}}<li><div id="ignore-message">{{$ignored}}</div></li>{{/if}}
{{if $archived}}<li><div id="archive-message">{{$archived}}</div></li>{{/if}}
</ul>
<ul>
<!-- <li><a href="network/?cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent}}</a></li> -->
{{if $follow}}<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
{{* Some information about the contact from the profile *}}

View file

@ -10,5 +10,20 @@
{{/if}}
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
{{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
<div id="profile-extra-links">
<ul>
{{if $follow_link}}
<li><a id="dfrn-request-link" href="{{$follow_link}}">{{$follow}}</a></li>
{{/if}}
{{if $unfollow_link}}
<li><a id="dfrn-request-link" href="{{$unfollow_link}}">{{$unfollow}}</a></li>
{{/if}}
{{if $wallmessage_link}}
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
{{/if}}
</ul>
</div>
<div id="profile-vcard-break"></div>
</div>

View file

@ -58,11 +58,6 @@
{{if $ignored}}<li><div id="ignore-message">{{$ignored}}</div></li>{{/if}}
{{if $archived}}<li><div id="archive-message">{{$archived}}</div></li>{{/if}}
</ul>
<ul>
<!-- <li><a href="network/?cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent}}</a></li> -->
{{if $follow}}<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
<div id="contact-edit-links-end"></div>

View file

@ -34,5 +34,30 @@
{{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
</div>
<div id="profile-extra-links">
<div id="dfrn-request-link-button">
{{if $follow_link}}
<a id="dfrn-request-link" class="btn btn-labeled btn-primary btn-sm" href="{{$follow_link}}"">
<span class=""><i class="fa fa-user-plus"></i></span>
<span class="">{{$follow}}</span>
</a>
{{/if}}
{{if $unfollow_link}}
<a id="dfrn-request-link" class="btn btn-labeled btn-primary btn-sm" href="{{$unfollow_link}}">
<span class=""><i class="fa fa-user-times"></i></span>
<span class="">{{$unfollow}}</span>
</a>
{{/if}}
</div>
{{if $wallmessage_link}}
<div id="wallmessage-link-botton">
<button type="button" id="wallmessage-link" class="btn btn-labeled btn-primary btn-sm" onclick="openWallMessage('{{$wallmessage_link}}')">
<span class=""><i class="fa fa-envelope"></i></span>
<span class="">{{$wallmessage}}</span>
</button>
</div>
{{/if}}
</div>
</div>
</div>

View file

@ -45,11 +45,6 @@
{{if $ignored}}<li><div id="ignore-message">{{$ignored}}</div></li>{{/if}}
{{if $archived}}<li><div id="archive-message">{{$archived}}</div></li>{{/if}}
</ul>
<ul>
<!-- <li><a href="network/?cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent}}</a></li> -->
{{if $follow}}<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
{{* Some information about the contact from the profile *}}