diff --git src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php
index c5ddaddf9..f06425d07 100644
|
|
|
|
| 154 | 154 | <div class="thread-content" data-thread-id="{{data.id}}"> |
| 155 | 155 | <div class="thread-subject"> |
| 156 | 156 | <span class="thread-count">({{data.count}})</span> |
| 157 | | <a class="subject" href="#view/{{data.id}}">{{data.subject}}</a> |
| | 157 | <a class="subject" href="../view/{{data.id}}/">{{data.subject}}</a> |
| 158 | 158 | </div> |
| 159 | 159 | <p class="excerpt">{{data.excerpt}}</p> |
| 160 | 160 | </div> |
| … |
… |
|
| 203 | 203 | |
| 204 | 204 | <# } #> |
| 205 | 205 | |
| 206 | | <a href="#view/{{data.id}}" class="message-action-view bp-tooltip bp-icons" data-bp-tooltip="<?php esc_attr_e( 'View full conversation and reply.', 'buddypress' ); ?>"> |
| | 206 | <a href="../view/{{data.id}}/" class="message-action-view bp-tooltip bp-icons" data-bp-action="view" data-bp-tooltip="<?php esc_attr_e( 'View full conversation and reply.', 'buddypress' ); ?>"> |
| 207 | 207 | <span class="bp-screen-reader-text"><?php esc_html_e( 'View full conversation and reply.', 'buddypress' ); ?></span> |
| 208 | 208 | </a> |
| 209 | 209 | </div> |
diff --git src/bp-templates/bp-nouveau/includes/messages/functions.php src/bp-templates/bp-nouveau/includes/messages/functions.php
index 191a85381..97c1b09f7 100644
|
|
|
function bp_nouveau_messages_localize_scripts( $params = array() ) { |
| 114 | 114 | 'one' => __( '(and 1 other)', 'buddypress' ), |
| 115 | 115 | 'more' => __( '(and %d others)', 'buddypress' ), |
| 116 | 116 | ), |
| | 117 | 'rootUrl' => trailingslashit( str_replace( home_url(), '', bp_displayed_user_domain() ) . bp_get_messages_slug() ), |
| 117 | 118 | ); |
| 118 | 119 | |
| 119 | 120 | // Star private messages. |
| … |
… |
function bp_nouveau_messages_adjust_nav() { |
| 178 | 179 | |
| 179 | 180 | if ( 'notices' === $secondary_nav_item->slug ) { |
| 180 | 181 | bp_core_remove_subnav_item( bp_get_messages_slug(), $secondary_nav_item->slug, 'members' ); |
| 181 | | } else { |
| 182 | | $params = array( 'link' => '#' . $secondary_nav_item->slug ); |
| 183 | | |
| 184 | | // Make sure Admins won't write a messages from the user's account. |
| 185 | | if ( 'compose' === $secondary_nav_item->slug ) { |
| 186 | | $params['user_has_access'] = bp_is_my_profile(); |
| 187 | | } |
| 188 | | |
| 189 | | $bp->members->nav->edit_nav( $params, $secondary_nav_item->slug, bp_get_messages_slug() ); |
| | 182 | } elseif ( 'compose' === $secondary_nav_item->slug ) { |
| | 183 | $bp->members->nav->edit_nav( array( |
| | 184 | 'user_has_access' => bp_is_my_profile() |
| | 185 | ), $secondary_nav_item->slug, bp_get_messages_slug() ); |
| 190 | 186 | } |
| 191 | 187 | } |
| 192 | 188 | } |
| … |
… |
function bp_nouveau_messages_adjust_admin_nav( $admin_nav ) { |
| 204 | 200 | foreach ( $admin_nav as $nav_iterator => $nav ) { |
| 205 | 201 | $nav_id = str_replace( 'my-account-messages-', '', $nav['id'] ); |
| 206 | 202 | |
| 207 | | if ( 'my-account-messages' !== $nav_id ) { |
| 208 | | if ( 'notices' === $nav_id ) { |
| 209 | | $admin_nav[ $nav_iterator ]['href'] = esc_url( add_query_arg( array( 'page' => 'bp-notices' ), bp_get_admin_url( 'users.php' ) ) ); |
| 210 | | } else { |
| 211 | | $admin_nav[ $nav_iterator ]['href'] = $user_messages_link . '#' . trim( $nav_id ); |
| 212 | | } |
| | 203 | if ( 'notices' === $nav_id ) { |
| | 204 | $admin_nav[ $nav_iterator ]['href'] = esc_url( add_query_arg( array( |
| | 205 | 'page' => 'bp-notices' |
| | 206 | ), bp_get_admin_url( 'users.php' ) ) ); |
| 213 | 207 | } |
| 214 | 208 | } |
| 215 | 209 | |
diff --git src/bp-templates/bp-nouveau/js/buddypress-messages.js src/bp-templates/bp-nouveau/js/buddypress-messages.js
index 7c1ad32d4..699072f8f 100644
|
|
|
window.bp = window.bp || {}; |
| 37 | 37 | |
| 38 | 38 | this.setupNav(); |
| 39 | 39 | |
| 40 | | Backbone.history.start(); |
| | 40 | Backbone.history.start( { |
| | 41 | pushState: true, |
| | 42 | root: BP_Nouveau.messages.rootUrl |
| | 43 | } ); |
| 41 | 44 | }, |
| 42 | 45 | |
| 43 | 46 | setupNav: function() { |
| … |
… |
window.bp = window.bp || {}; |
| 69 | 72 | } |
| 70 | 73 | |
| 71 | 74 | // Navigate back to current box |
| 72 | | self.router.navigate( self.box, { trigger: true } ); |
| | 75 | self.router.navigate( self.box + '/', { trigger: true } ); |
| 73 | 76 | |
| 74 | 77 | // Otherwise load it |
| 75 | 78 | } else { |
| 76 | | self.router.navigate( 'compose', { trigger: true } ); |
| | 79 | self.router.navigate( 'compose/', { trigger: true } ); |
| 77 | 80 | } |
| 78 | 81 | |
| 79 | 82 | // Other views are classic. |
| … |
… |
window.bp = window.bp || {}; |
| 82 | 85 | if ( self.box !== view_id || ! _.isUndefined( self.views.get( 'compose' ) ) ) { |
| 83 | 86 | self.clearViews(); |
| 84 | 87 | |
| 85 | | self.router.navigate( view_id, { trigger: true } ); |
| | 88 | self.router.navigate( view_id + '/', { trigger: true } ); |
| 86 | 89 | } |
| 87 | 90 | } |
| 88 | 91 | } ); |
| … |
… |
window.bp = window.bp || {}; |
| 616 | 619 | form.get( 'view' ).remove(); |
| 617 | 620 | bp.Nouveau.Messages.views.remove( { id: 'compose', view: form } ); |
| 618 | 621 | |
| 619 | | bp.Nouveau.Messages.router.navigate( 'sentbox', { trigger: true } ); |
| | 622 | bp.Nouveau.Messages.router.navigate( 'sentbox/', { trigger: true } ); |
| 620 | 623 | } ).fail( function( response ) { |
| 621 | 624 | if ( response.feedback ) { |
| 622 | 625 | bp.Nouveau.Messages.displayFeedback( response.feedback, response.type ); |
| … |
… |
window.bp = window.bp || {}; |
| 712 | 715 | bp.Nouveau.Messages.removeFeedback(); |
| 713 | 716 | |
| 714 | 717 | // If the click is done on an active conversation, open it. |
| 715 | | if ( $( event.currentTarget ).closest( '.thread-item' ).hasClass( 'selected' ) ) { |
| 716 | | this.loadSingleView( event ); |
| | 718 | if ( target.closest( '.thread-item' ).hasClass( 'selected' ) ) { |
| | 719 | bp.Nouveau.Messages.router.navigate( |
| | 720 | 'view/' + target.closest( '.thread-content' ).data( 'thread-id' ) + '/', |
| | 721 | { trigger: true } |
| | 722 | ); |
| 717 | 723 | |
| 718 | 724 | // Otherwise activate the conversation and display its preview. |
| 719 | 725 | } else { |
| … |
… |
window.bp = window.bp || {}; |
| 721 | 727 | |
| 722 | 728 | $( '.message-action-view' ).focus(); |
| 723 | 729 | } |
| 724 | | }, |
| 725 | | |
| 726 | | loadSingleView: function( event ) { |
| 727 | | event.preventDefault(); |
| 728 | | |
| 729 | | bp.Nouveau.Messages.router.navigate( |
| 730 | | 'view/' + $( event.currentTarget ).closest( '.thread-content' ).data( 'thread-id' ), |
| 731 | | { trigger: true } |
| 732 | | ); |
| 733 | 730 | } |
| 734 | 731 | } ); |
| 735 | 732 | |
| … |
… |
window.bp = window.bp || {}; |
| 895 | 892 | |
| 896 | 893 | mid = model.get( 'id' ); |
| 897 | 894 | |
| 898 | | if ( 'star' === action || 'unstar' === action ) { |
| | 895 | // Open the full conversation |
| | 896 | if ( 'view' === action ) { |
| | 897 | bp.Nouveau.Messages.router.navigate( |
| | 898 | 'view/' + mid + '/', |
| | 899 | { trigger: true } |
| | 900 | ); |
| | 901 | |
| | 902 | return; |
| | 903 | |
| | 904 | // Star/Unstar actions needs to use a specific id and nonce. |
| | 905 | } else if ( 'star' === action || 'unstar' === action ) { |
| 899 | 906 | options.data = { |
| 900 | 907 | 'star_nonce' : model.get( 'star_nonce' ) |
| 901 | 908 | }; |
| … |
… |
window.bp = window.bp || {}; |
| 1323 | 1330 | |
| 1324 | 1331 | bp.Nouveau.Messages.Router = Backbone.Router.extend( { |
| 1325 | 1332 | routes: { |
| 1326 | | 'compose' : 'composeMessage', |
| 1327 | | 'view/:id': 'viewMessage', |
| 1328 | | 'sentbox' : 'sentboxView', |
| 1329 | | 'starred' : 'starredView', |
| 1330 | | 'inbox' : 'inboxView', |
| | 1333 | 'compose/' : 'composeMessage', |
| | 1334 | 'view/:id/': 'viewMessage', |
| | 1335 | 'sentbox/' : 'sentboxView', |
| | 1336 | 'starred/' : 'starredView', |
| | 1337 | 'inbox/' : 'inboxView', |
| 1331 | 1338 | '' : 'inboxView' |
| 1332 | 1339 | }, |
| 1333 | 1340 | |