From 057fcde772a2cf144a58ae884f4623a69e34a392 Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Mon, 21 Jul 2025 10:15:58 -0500 Subject: [PATCH 1/2] Following: Improve follow error handling Enhanced error messages when following accounts by providing more specific feedback and preserving the entered profile on redirect. Updated template text for clarity and consistency in the following list UI. --- includes/table/class-following.php | 6 ++++-- templates/following-list.php | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/table/class-following.php b/includes/table/class-following.php index d747fb52e..4a9a7146b 100644 --- a/includes/table/class-following.php +++ b/includes/table/class-following.php @@ -111,7 +111,7 @@ public function process_action() { } break; case 'follow': - $redirect_to = \remove_query_arg( array( 's' ), $redirect_to ); + $redirect_to = \remove_query_arg( array( 'resource', 's' ), $redirect_to ); if ( ! isset( $_REQUEST['activitypub-profile'], $_REQUEST['_wpnonce'] ) ) { return; @@ -125,7 +125,9 @@ public function process_action() { $profile = \sanitize_text_field( \wp_unslash( $_REQUEST['activitypub-profile'] ) ); $result = follow( $profile, $this->user_id ); if ( \is_wp_error( $result ) ) { - \add_settings_error( 'activitypub', 'followed', $result->get_error_message() ); + /* translators: %s: Account profile that could not be followed */ + \add_settings_error( 'activitypub', 'followed', \sprintf( \__( 'Unable to follow account “%s”. Please verify the account exists and try again.', 'activitypub' ), \esc_html( $profile ) ) ); + $redirect_to = \add_query_arg( 'resource', $profile, $redirect_to ); } else { \add_settings_error( 'activitypub', 'followed', \__( 'Account followed.', 'activitypub' ), 'success' ); } diff --git a/templates/following-list.php b/templates/following-list.php index 6c3bd1927..8d7dcdc01 100644 --- a/templates/following-list.php +++ b/templates/following-list.php @@ -63,7 +63,7 @@
  • https://example.com/@username', 'activitypub' ) ); ?>

  • -

    +

    @@ -78,11 +78,10 @@
    -

    +

    - From be066a2152772f69a88d1bd60ea8f982cf15ee9c Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Mon, 21 Jul 2025 10:23:30 -0500 Subject: [PATCH 2/2] Fix comma placement --- templates/following-list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/following-list.php b/templates/following-list.php index 8d7dcdc01..48a9bb227 100644 --- a/templates/following-list.php +++ b/templates/following-list.php @@ -78,7 +78,7 @@
    -

    +