Reply to comments from Dashboard

This commit is contained in:
Django Doucet 2023-03-10 08:43:03 -07:00
parent 30129adac5
commit 116070e23c
3 changed files with 18 additions and 2 deletions

View file

@ -19,7 +19,7 @@ jQuery( function( $ ) {
} ); } );
//Reply Comment-edit screen //Reply Comment-edit screen
if ( $('body').hasClass('edit-comments-php') ) { if ( $('body').hasClass('edit-comments-php') || $('body').hasClass('index-php') ) {
//Insert Mentions into comment content on reply //Insert Mentions into comment content on reply
$( '.comment-inline.button-link' ).on( 'click', function( event ) { $( '.comment-inline.button-link' ).on( 'click', function( event ) {
var recipients = $(this).attr('data-recipients') ? $(this).attr('data-recipients') + ' ' : ''; var recipients = $(this).attr('data-recipients') ? $(this).attr('data-recipients') + ' ' : '';

View file

@ -184,7 +184,7 @@ class Admin {
} }
public static function enqueue_scripts( $hook_suffix ) { public static function enqueue_scripts( $hook_suffix ) {
if ( false !== strpos( $hook_suffix, 'activitypub' ) || ( 'edit-comments.php' === $hook_suffix ) ) { if ( false !== strpos( $hook_suffix, 'activitypub' ) || ( 'edit-comments.php' === $hook_suffix ) || ( 'index.php' === $hook_suffix ) ) {
wp_enqueue_style( 'activitypub-admin-styles', plugins_url( 'assets/css/activitypub-admin.css', ACTIVITYPUB_PLUGIN_FILE ), array(), '1.0.0' ); wp_enqueue_style( 'activitypub-admin-styles', plugins_url( 'assets/css/activitypub-admin.css', ACTIVITYPUB_PLUGIN_FILE ), array(), '1.0.0' );
wp_enqueue_script( 'activitypub-admin-styles', plugins_url( 'assets/js/activitypub-admin.js', ACTIVITYPUB_PLUGIN_FILE ), array( 'jquery' ), '1.0.0', false ); wp_enqueue_script( 'activitypub-admin-styles', plugins_url( 'assets/js/activitypub-admin.js', ACTIVITYPUB_PLUGIN_FILE ), array( 'jquery' ), '1.0.0', false );
} }

View file

@ -13,6 +13,7 @@ class Comments {
public static function init() { public static function init() {
\add_filter( 'preprocess_comment', array( '\Activitypub\Comments', 'preprocess_comment' ) ); \add_filter( 'preprocess_comment', array( '\Activitypub\Comments', 'preprocess_comment' ) );
\add_filter( 'comment_excerpt', array( '\Activitypub\Comments', 'comment_excerpt' ), 10, 3 );
\add_filter( 'comment_text', array( '\Activitypub\Comments', 'comment_content_filter' ), 10, 3 ); \add_filter( 'comment_text', array( '\Activitypub\Comments', 'comment_content_filter' ), 10, 3 );
\add_filter( 'comment_post', array( '\Activitypub\Comments', 'postprocess_comment' ), 10, 3 ); \add_filter( 'comment_post', array( '\Activitypub\Comments', 'postprocess_comment' ), 10, 3 );
\add_filter( 'wp_update_comment_data', array( '\Activitypub\Comments', 'comment_updated_published' ), 20, 3 ); \add_filter( 'wp_update_comment_data', array( '\Activitypub\Comments', 'comment_updated_published' ), 20, 3 );
@ -40,6 +41,21 @@ class Comments {
return $commentdata; return $commentdata;
} }
/**
* comment_excerpt( $comment_excerpt, $comment_ID )
* Filters the comment text for display in the Recently Published Dashboard Widget.
*
* @param string $comment_text
* @param int $comment_ID
* @param array $args
* @return void
*/
public static function comment_excerpt( $comment_excerpt, $comment_ID ) {
$comment = get_comment( $comment_ID );
$comment_excerpt = \apply_filters( 'the_content', $comment_excerpt, $comment );
return $comment_excerpt;
}
/** /**
* comment_text( $comment ) * comment_text( $comment )
* Filters the comment text for display. * Filters the comment text for display.