@@ -61,23 +61,18 @@ public function process_action() {
61
61
case 'delete ' :
62
62
// Handle single follower deletion.
63
63
if ( isset ( $ _GET ['follower ' ], $ _GET ['_wpnonce ' ] ) ) {
64
- $ follower = \esc_url_raw ( \wp_unslash ( $ _GET ['follower ' ] ) );
64
+ $ follower = \absint ( $ _GET ['follower ' ] );
65
65
$ nonce = \sanitize_text_field ( \wp_unslash ( $ _GET ['_wpnonce ' ] ) );
66
66
67
67
if ( \wp_verify_nonce ( $ nonce , 'delete-follower_ ' . $ follower ) ) {
68
- $ actor = Actors::get_remote_by_uri ( $ follower );
69
- if ( \is_wp_error ( $ actor ) ) {
70
- break ;
71
- }
72
-
73
- Following_Collection::unfollow ( $ actor , $ this ->user_id );
68
+ Following_Collection::unfollow ( $ follower , $ this ->user_id );
74
69
75
70
$ redirect_args = array (
76
71
'updated ' => 'true ' ,
77
72
'action ' => 'deleted ' ,
78
73
);
79
74
80
- \wp_safe_redirect ( \add_query_arg ( $ redirect_args ) );
75
+ \wp_safe_redirect ( \add_query_arg ( $ redirect_args, \remove_query_arg ( array ( ' follower ' ) ) ) );
81
76
exit ;
82
77
}
83
78
}
@@ -87,14 +82,10 @@ public function process_action() {
87
82
$ nonce = \sanitize_text_field ( \wp_unslash ( $ _REQUEST ['_wpnonce ' ] ) );
88
83
89
84
if ( \wp_verify_nonce ( $ nonce , 'bulk- ' . $ this ->_args ['plural ' ] ) ) {
90
- $ following = array_map ( 'esc_url_raw ' , \wp_unslash ( $ _REQUEST ['following ' ] ) );
91
-
92
- foreach ( $ following as $ actor_id ) {
93
- $ actor = Actors::get_remote_by_uri ( $ actor_id );
94
- if ( \is_wp_error ( $ actor ) ) {
95
- continue ;
96
- }
97
- Following_Collection::unfollow ( $ actor , $ this ->user_id );
85
+ $ following = array_map ( 'absint ' , \wp_unslash ( $ _REQUEST ['following ' ] ) );
86
+
87
+ foreach ( $ following as $ post_id ) {
88
+ Following_Collection::unfollow ( $ post_id , $ this ->user_id );
98
89
}
99
90
100
91
$ redirect_args = array (
@@ -103,7 +94,7 @@ public function process_action() {
103
94
'count ' => \count ( $ following ),
104
95
);
105
96
106
- \wp_safe_redirect ( \add_query_arg ( $ redirect_args ) );
97
+ \wp_safe_redirect ( \add_query_arg ( $ redirect_args, \remove_query_arg ( array ( ' following ' ) ) ) );
107
98
exit ;
108
99
}
109
100
}
@@ -343,7 +334,7 @@ public function column_default( $item, $column_name ) {
343
334
* @return string
344
335
*/
345
336
public function column_cb ( $ item ) {
346
- return \sprintf ( '<input type="checkbox" name="following[]" value="%s" /> ' , \esc_attr ( $ item ['identifier ' ] ) );
337
+ return \sprintf ( '<input type="checkbox" name="following[]" value="%s" /> ' , \esc_attr ( $ item ['id ' ] ) );
347
338
}
348
339
349
340
/**
@@ -428,10 +419,10 @@ protected function handle_row_actions( $item, $column_name, $primary ) {
428
419
\add_query_arg (
429
420
array (
430
421
'action ' => 'delete ' ,
431
- 'follower ' => $ item ['identifier ' ],
422
+ 'follower ' => $ item ['id ' ],
432
423
)
433
424
),
434
- 'delete-follower_ ' . $ item ['identifier ' ]
425
+ 'delete-follower_ ' . $ item ['id ' ]
435
426
),
436
427
/* translators: %s: username. */
437
428
\esc_attr ( \sprintf ( \__ ( 'Unfollow %s ' , 'activitypub ' ), $ item ['username ' ] ) ),
0 commit comments