Ticket #7135: 7135.01.patch
File 7135.01.patch, 6.1 KB (added by , 9 years ago) |
---|
-
src/bp-activity/bp-activity-functions.php
3030 3030 $link = $activity_obj->primary_link; 3031 3031 } else { 3032 3032 if ( 'activity_comment' == $activity_obj->type ) { 3033 $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->item_id . '/ ';3033 $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->item_id . '/#acomment-' . $activity_obj->id; 3034 3034 } else { 3035 3035 $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->id . '/'; 3036 3036 } -
src/bp-activity/bp-activity-notifications.php
242 242 $text = sprintf( __( 'You have %1$d new replies', 'buddypress' ), (int) $total_items ); 243 243 $amount = 'multiple'; 244 244 } else { 245 $link = bp_activity_get_permalink( $activity_id ); 246 $text = sprintf( __( '%1$s commented on one of your updates', 'buddypress' ), $user_fullname ); 245 $link = add_query_arg( 246 array( 247 'aid' => $activity_id, 248 'n' => 'update_reply' 249 ), 250 bp_activity_get_permalink( $activity_id ) 251 ); 252 $text = sprintf( __( '%1$s commented on one of your updates', 'buddypress' ), $user_fullname ); 247 253 } 248 254 break; 249 255 … … 257 263 $text = sprintf( __( 'You have %1$d new comment replies', 'buddypress' ), (int) $total_items ); 258 264 $amount = 'multiple'; 259 265 } else { 260 $link = bp_activity_get_permalink( $activity_id ); 261 $text = sprintf( __( '%1$s replied to one your activity comments', 'buddypress' ), $user_fullname ); 266 $link = add_query_arg( 267 array( 268 'aid' => $activity_id, 269 'n' => 'comment_reply' 270 ), 271 bp_activity_get_permalink( $activity_id ) 272 ); 273 $text = sprintf( __( '%1$s replied to one your activity comments', 'buddypress' ), $user_fullname ); 262 274 } 263 275 break; 264 276 } … … 365 377 if ( bp_is_active( 'notifications' ) ) { 366 378 bp_notifications_add_notification( array( 367 379 'user_id' => $activity->user_id, 368 'item_id' => $ activity->id,380 'item_id' => $comment_id, 369 381 'secondary_item_id' => $commenter_id, 370 382 'component_name' => buddypress()->activity->id, 371 383 'component_action' => 'update_reply', … … 389 401 if ( bp_is_active( 'notifications' ) ) { 390 402 bp_notifications_add_notification( array( 391 403 'user_id' => $activity_comment->user_id, 392 'item_id' => $ activity_comment->item_id,404 'item_id' => $comment_id, 393 405 'secondary_item_id' => $commenter_id, 394 406 'component_name' => buddypress()->activity->id, 395 407 'component_action' => 'comment_reply', … … 426 438 * Mark at-mention notification as read when user visits the activity with the mention. 427 439 * 428 440 * @since 2.0.0 429 * @since 2.6.0 Mark notifications for 'update_reply' and 'comment_reply' actions430 441 * 431 442 * @param BP_Activity_Activity $activity Activity object. 432 443 */ … … 439 450 return; 440 451 } 441 452 442 /** 443 * Filter here to add the notification actions to mark as read 444 * when the single activity is displayed. 445 * 446 * @since 2.6.0 447 * 448 * @param array $value List of notification actions to mark as read. 449 */ 450 $notification_actions = apply_filters( 'bp_activity_notification_actions_single_activity', array( 451 'new_at_mention', 452 'update_reply', 453 'comment_reply', 454 ) ); 455 456 $user_id = bp_loggedin_user_id(); 457 $component = buddypress()->activity->id; 458 459 foreach ( $notification_actions as $action ) { 460 // Mark as read any notifications for the current user related to this activity item. 461 bp_notifications_mark_notifications_by_item_id( $user_id, $activity->id, $component, $action ); 462 } 453 // Mark as read any notifications for the current user related to this activity item. 454 bp_notifications_mark_notifications_by_item_id( bp_loggedin_user_id(), $activity->id, buddypress()->activity->id, 'new_at_mention' ); 463 455 } 464 456 add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications_single_activity_permalink' ); 465 457 466 458 /** 459 * Mark non-mention notifications as read when user visits our read permalink. 460 * 461 * In particular, 'update_reply' and 'comment_reply' notifications are handled 462 * here. See {@link bp_activity_format_notifications()} for more info. 463 * 464 * @since 2.6.0 465 */ 466 function bp_activity_remove_screen_notifications_for_non_mentions() { 467 if ( false === bp_is_active( 'notifications' ) || false === is_singular() || false === is_user_logged_in() || empty( $_GET['aid'] ) || empty( $_GET['n'] ) ) { 468 return; 469 } 470 471 bp_notifications_mark_notifications_by_item_id( bp_loggedin_user_id(), $_GET['aid'], buddypress()->activity->id, $_GET['n'] ); 472 } 473 add_action( 'bp_screens', 'bp_activity_remove_screen_notifications_for_non_mentions' ); 474 475 /** 467 476 * Delete at-mention notifications when the corresponding activity item is deleted. 468 477 * 469 478 * @since 2.0.0 -
src/bp-activity/bp-activity-template.php
2420 2420 * 2421 2421 * @since 1.8.0 2422 2422 * 2423 *2424 2423 * @return string $link The activity comment permalink. 2425 2424 */ 2426 2425 function bp_get_activity_comment_permalink() { 2427 2426 global $activities_template; 2428 2427 2429 // Check that comment exists. 2428 $link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ); 2429 2430 // Used for filter below. 2430 2431 $comment_id = isset( $activities_template->activity->current_comment->id ) 2431 2432 ? $activities_template->activity->current_comment->id 2432 2433 : 0; 2433 2434 2434 // Setup the comment link.2435 $comment_link = ! empty( $comment_id )2436 ? '#acomment-' .$comment_id2437 : false;2438 2439 // Append comment ID to end of activity permalink.2440 $link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . $comment_link;2441 2442 2435 /** 2443 2436 * Filters the activity comment permalink. 2444 2437 *