Skip to content

Commit 6017ddc

Browse files
authored
Remove fediverse reply link for received comments (#2461)
1 parent 7f43ae4 commit 6017ddc

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Simplified reply links by removing special handling for federated comments, making replies work the same for all comments where replying is allowed.

includes/class-comment.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ public static function map_meta_cap( $caps, $cap, $user_id, $args ) {
6969
*/
7070
public static function comment_reply_link( $link, $args, $comment ) {
7171
if ( self::are_comments_allowed( $comment ) ) {
72-
if ( \current_user_can( 'activitypub' ) && self::was_received( $comment ) ) {
73-
return self::create_fediverse_reply_link( $link, $args );
74-
}
75-
7672
return $link;
7773
}
7874

@@ -95,28 +91,6 @@ public static function comment_reply_link( $link, $args, $comment ) {
9591
return \apply_filters( 'activitypub_comment_reply_link', $block );
9692
}
9793

98-
/**
99-
* Create a link to reply to a federated comment.
100-
*
101-
* This function adds a title attribute to the reply link to inform the user
102-
* that the comment was received from the fediverse and the reply will be sent
103-
* to the original author.
104-
*
105-
* @param string $link The HTML markup for the comment reply link.
106-
* @param array $args The args provided by the `comment_reply_link` filter.
107-
*
108-
* @return string The modified HTML markup for the comment reply link.
109-
*/
110-
private static function create_fediverse_reply_link( $link, $args ) {
111-
$str_to_replace = sprintf( '>%s<', $args['reply_text'] );
112-
$replace_with = sprintf(
113-
' title="%s">%s<',
114-
esc_attr__( 'This comment was received from the fediverse and your reply will be sent to the original author', 'activitypub' ),
115-
esc_html__( 'Reply with federation', 'activitypub' )
116-
);
117-
return str_replace( $str_to_replace, $replace_with, $link );
118-
}
119-
12094
/**
12195
* Check if it is allowed to comment to a comment.
12296
*

0 commit comments

Comments
 (0)