Skip to content

Commit 88591e8

Browse files
obenlandpfefferle
andauthored
HTTP: Make it easier to search for users to follow (#1967)
Co-authored-by: Matthias Pfefferle <[email protected]>
1 parent 3b2f229 commit 88591e8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

includes/table/class-following.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ public function process_action() {
123123
}
124124

125125
$profile = \sanitize_text_field( \wp_unslash( $_REQUEST['activitypub-profile'] ) );
126-
$result = follow( $profile, $this->user_id );
126+
if ( ! \is_email( \ltrim( $profile, '@' ) ) && empty( \wp_parse_url( $profile, PHP_URL_SCHEME ) ) ) {
127+
// Add scheme if missing.
128+
$profile = \esc_url_raw( 'https://' . \ltrim( $profile, '/' ) );
129+
}
130+
131+
$result = follow( $profile, $this->user_id );
127132
if ( \is_wp_error( $result ) ) {
128133
/* translators: %s: Account profile that could not be followed */
129134
\add_settings_error( 'activitypub', 'followed', \sprintf( \__( 'Unable to follow account &#8220;%s&#8221;. Please verify the account exists and try again.', 'activitypub' ), \esc_html( $profile ) ) );

0 commit comments

Comments
 (0)