<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][12322] trunk/src/bp-templates/bp-nouveau: Nouveau: Fixes for the Friends Request page.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/12322">12322</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/12322","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>boonebgorges</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-01-10 19:57:41 +0000 (Thu, 10 Jan 2019)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Nouveau: Fixes for the Friends Request page.

The Friends Request page was introduced in Nouveau with the same dropdown
filter as on other member directories, but the functionality was never
fully implemented. In this changeset, we make the following changes:

* Ensure that the AJAX request distinguishes between friend request queries and other membership queries, so that the members returned are limited to friend requests.
* Break the friend request loop logic into its own template, so that the outer template information (title, pagination, etc) doesn't appear twice after an AJAX filter.
* Modify the logic in the friend-request template so that it uses `bp_ajax_querystring()`, which lets the filters affect the returned results.

Props imath.
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/8035">#8035</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbptemplatesbpnouveaubuddypressmemberssinglefriendsrequestsphp">trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveauincludesajaxphp">trunk/src/bp-templates/bp-nouveau/includes/ajax.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveauincludestemplatetagsphp">trunk/src/bp-templates/bp-nouveau/includes/template-tags.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaujsbuddypressnouveaujs">trunk/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcbptemplatesbpnouveaubuddypressmemberssinglefriendsrequestsloopphp">trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests-loop.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbptemplatesbpnouveaubuddypressmemberssinglefriendsrequestsloopphpfromrev12321trunksrcbptemplatesbpnouveaubuddypressmemberssinglefriendsrequestsphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests-loop.php (from rev 12321, trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests-loop.php                             (rev 0)
+++ trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests-loop.php       2019-01-10 19:57:41 UTC (rev 12322)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,46 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * BuddyPress - Members Friends Requests Loop
+ *
+ * @since 5.0.0
+ * @version 5.0.0
+ */
+?>
+
+<?php if ( bp_has_members( bp_ajax_querystring( 'friendship_requests' ) . '&include=' . bp_get_friendship_requests() ) ) : ?>
+
+       <?php bp_nouveau_pagination( 'top' ); ?>
+
+       <ul id="friend-list" class="<?php bp_nouveau_loop_classes(); ?>">
+               <?php
+               while ( bp_members() ) :
+                       bp_the_member();
+               ?>
+
+                       <li id="friendship-<?php bp_friend_friendship_id(); ?>" <?php bp_member_class( array( 'item-entry' ) ); ?> data-bp-item-id="<?php bp_friend_friendship_id(); ?>" data-bp-item-component="members">
+                               <div class="item-avatar">
+                                       <a href="<?php bp_member_link(); ?>"><?php bp_member_avatar( array( 'type' => 'full' ) ); ?></a>
+                               </div>
+
+                               <div class="item">
+                                       <div class="item-title"><a href="<?php bp_member_link(); ?>"><?php bp_member_name(); ?></a></div>
+                                       <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
+
+                                       <?php bp_nouveau_friend_hook( 'requests_item' ); ?>
+                               </div>
+
+                               <?php bp_nouveau_members_loop_buttons(); ?>
+                       </li>
+
+               <?php endwhile; ?>
+       </ul>
+
+       <?php bp_nouveau_friend_hook( 'requests_content' ); ?>
+
+       <?php bp_nouveau_pagination( 'bottom' ); ?>
+
+<?php else : ?>
+
+       <?php bp_nouveau_user_feedback( 'member-requests-none' ); ?>
+
+<?php endif; ?>
</ins></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaubuddypressmemberssinglefriendsrequestsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests.php  2018-12-07 20:23:03 UTC (rev 12321)
+++ trunk/src/bp-templates/bp-nouveau/buddypress/members/single/friends/requests.php    2019-01-10 19:57:41 UTC (rev 12322)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,7 +3,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * BuddyPress - Members Friends Requests
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 3.0.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @version 3.0.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @version 5.0.0
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,43 +11,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <?php bp_nouveau_member_hook( 'before', 'friend_requests_content' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php if ( bp_has_members( 'type=alphabetical&include=' . bp_get_friendship_requests() ) ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<div data-bp-list="friendship_requests">
+       <?php bp_get_template_part( 'members/single/friends/requests-loop' ); ?>
+</div>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <?php bp_nouveau_pagination( 'top' ); ?>
-
-       <ul id="friend-list" class="<?php bp_nouveau_loop_classes(); ?>" data-bp-list="friendship_requests">
-               <?php
-               while ( bp_members() ) :
-                       bp_the_member();
-               ?>
-
-                       <li id="friendship-<?php bp_friend_friendship_id(); ?>" <?php bp_member_class( array( 'item-entry' ) ); ?> data-bp-item-id="<?php bp_friend_friendship_id(); ?>" data-bp-item-component="members">
-                               <div class="item-avatar">
-                                       <a href="<?php bp_member_link(); ?>"><?php bp_member_avatar( array( 'type' => 'full' ) ); ?></a>
-                               </div>
-
-                               <div class="item">
-                                       <div class="item-title"><a href="<?php bp_member_link(); ?>"><?php bp_member_name(); ?></a></div>
-                                       <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
-
-                                       <?php bp_nouveau_friend_hook( 'requests_item' ); ?>
-                               </div>
-
-                               <?php bp_nouveau_members_loop_buttons(); ?>
-                       </li>
-
-               <?php endwhile; ?>
-       </ul>
-
-       <?php bp_nouveau_friend_hook( 'requests_content' ); ?>
-
-       <?php bp_nouveau_pagination( 'bottom' ); ?>
-
-<?php else : ?>
-
-       <?php bp_nouveau_user_feedback( 'member-requests-none' ); ?>
-
-<?php endif; ?>
-
-<?php
-bp_nouveau_member_hook( 'after', 'friend_requests_content' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php bp_nouveau_member_hook( 'after', 'friend_requests_content' );
</ins></span></pre></div>
<a id="trunksrcbptemplatesbpnouveauincludesajaxphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/includes/ajax.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/includes/ajax.php       2018-12-07 20:23:03 UTC (rev 12321)
+++ trunk/src/bp-templates/bp-nouveau/includes/ajax.php 2019-01-10 19:57:41 UTC (rev 12322)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -110,6 +110,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $template_part = 'groups/single/requests-loop.php';
</span><span class="cx" style="display: block; padding: 0 10px">                break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                case 'friend_requests' :
+                       $template_part = 'members/single/friends/requests-loop.php';
+               break;
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 case 'member_notifications' :
</span><span class="cx" style="display: block; padding: 0 10px">                        $template_part = 'members/single/notifications/notifications-loop.php';
</span><span class="cx" style="display: block; padding: 0 10px">                break;
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveauincludestemplatetagsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/includes/template-tags.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/includes/template-tags.php      2018-12-07 20:23:03 UTC (rev 12321)
+++ trunk/src/bp-templates/bp-nouveau/includes/template-tags.php        2019-01-10 19:57:41 UTC (rev 12322)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1988,10 +1988,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        } else {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $data_filter = bp_current_component();
+               if ( 'friends' === $data_filter && bp_is_user_friend_requests() ) {
+                       $data_filter = 'friend_requests';
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $component['members_select']   = 'members-order-select';
</span><span class="cx" style="display: block; padding: 0 10px">                $component['members_order_by'] = 'members-order-by';
</span><span class="cx" style="display: block; padding: 0 10px">                $component['object']           = bp_current_component();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $component['data_filter']      = bp_current_component();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $component['data_filter']      = $data_filter;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        return $component;
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaujsbuddypressnouveaujs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js        2018-12-07 20:23:03 UTC (rev 12321)
+++ trunk/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js  2019-01-10 19:57:41 UTC (rev 12322)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -285,7 +285,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $( this.objectNavParent + ' [data-bp-scope="' + data.scope + '"], #object-nav li.current' ).addClass( 'selected loading' );
</span><span class="cx" style="display: block; padding: 0 10px">                        $( '#buddypress [data-bp-filter="' + data.object + '"] option[value="' + data.filter + '"]' ).prop( 'selected', true );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( 'friends' === data.object || 'group_members' === data.object ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( 'friends' === data.object || 'friend_requests' === data.object || 'group_members' === data.object ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 data.template = data.object;
</span><span class="cx" style="display: block; padding: 0 10px">                                data.object   = 'members';
</span><span class="cx" style="display: block; padding: 0 10px">                        } else if ( 'group_requests' === data.object ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -574,10 +574,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                search_terms = $( '#buddypress [data-bp-search="' + object + '"] input[type=search]' ).val();
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( 'friends' === object ) {
-                               object = 'members';
-                       }
-
</del><span class="cx" style="display: block; padding: 0 10px">                         self.objectRequest( {
</span><span class="cx" style="display: block; padding: 0 10px">                                object       : object,
</span><span class="cx" style="display: block; padding: 0 10px">                                scope        : scope,
</span></span></pre>
</div>
</div>

</body>
</html>