]> git.mxchange.org Git - friendica.git/commitdiff
Normalize the contact sidebar with the profile sidebar
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 11 Jun 2019 01:40:44 +0000 (21:40 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 11 Jun 2019 01:56:06 +0000 (21:56 -0400)
- Remove un/follow text links in contact status window

src/Module/Contact.php
view/templates/contact_edit.tpl
view/templates/widget/vcard.tpl
view/theme/frio/templates/contact_edit.tpl
view/theme/frio/templates/widget/vcard.tpl
view/theme/vier/templates/contact_edit.tpl

index 989896ef73b2ca00530697e969c6bf66cc80328a..feae601fddf0acc9a97dcff4e9f1abe79400020a 100644 (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')),
index 644121cadd082b13b1935f7aadc917a1bf11096f..d78d4162efa69042035619525cae1bae02938f92 100644 (file)
                                                {{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 *}}
index 240466460efff31630eb2baee11472f5db73d44a..465d206b81fb595be342ee127f1345cfda805b01 100644 (file)
        {{/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>
index 92ff615a9896400a83ba4273ce48e3c292a6f7c5..f9454dc654f3d5fdca2e90ed00b999764ef7fe9d 100644 (file)
                                                {{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>
index d1b41728b19fb7895e99e9ca4cc60541279128e7..366c570a747f81f349aa6ff449e7874e20edad39 100644 (file)
 
                        {{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>
index a01fac9ee4f9fdcee0c6160e173832620950b42b..bd07f182130240f72ae896fd57185e555f8e1817 100644 (file)
                                                {{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 *}}