diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index 2e04dc5e8ee90..e2b7e30f1dd63 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -639,6 +639,18 @@ tr.wp-locked .row-actions .trash { display: block; } +.join-action-text { + display: none; +} + +.wp-collaborative-editing .edit-action-text { + display: none; +} + +.wp-collaborative-editing .join-action-text { + display: inline; +} + #menu-locations-wrap .widefat { width: 60%; } diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 8cff2b87fad03..fc039a7573f19 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -1491,24 +1491,44 @@ protected function handle_row_actions( $item, $column_name, $primary ) { $title = _draft_or_post_title(); if ( $can_edit_post && 'trash' !== $post->post_status ) { - $is_rtc_locked = get_option( 'wp_collaboration_enabled' ) && wp_check_post_lock( $post->ID ); + $is_rtc_enabled = (bool) get_option( 'wp_collaboration_enabled' ); - $actions['edit'] = sprintf( - '%s', - get_edit_post_link( $post->ID ), - esc_attr( - sprintf( - $is_rtc_locked - /* translators: %s: Post title. */ - ? __( 'Join editing “%s”', 'post list' ) - /* translators: %s: Post title. */ - : __( 'Edit “%s”' ), - $title - ) - ), - /* translators: Action link text for a singular post in the post list. Can be any type of post. */ - $is_rtc_locked ? _x( 'Join', 'post list' ) : __( 'Edit' ) - ); + /* + * When RTC is enabled, both "Edit" and "Join" labels are rendered. + * The visible label is toggled by CSS based on the row's + * `wp-collaborative-editing` class, which is added or removed by + * inline-edit-post.js in response to heartbeat ticks. + */ + if ( $is_rtc_enabled ) { + $actions['edit'] = sprintf( + '' + . '' + . '' + . '%3$s' + . '' + . '' + . '' + . '%5$s' + . '' + . '', + get_edit_post_link( $post->ID ), + __( 'Edit' ), + /* translators: %s: Post title. */ + sprintf( __( 'Edit “%s”' ), $title ), + /* translators: Action link text for a singular post in the post list. Can be any type of post. */ + _x( 'Join', 'post list' ), + /* translators: %s: Post title. */ + sprintf( __( 'Join editing “%s”', 'post list' ), $title ) + ); + } else { + $actions['edit'] = sprintf( + '%s', + get_edit_post_link( $post->ID ), + /* translators: %s: Post title. */ + esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), + __( 'Edit' ) + ); + } /** * Filters whether Quick Edit should be enabled for the given post type.