Skip to content

Commit f01dc70

Browse files
authored
Add default avatars for actors without icons in admin tables (#2106)
1 parent 2bea435 commit f01dc70

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
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: changed
3+
4+
Add default avatars for actors without icons in admin tables

includes/wp-admin/table/class-blocked-actors.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,12 @@ public function prepare_items() {
231231
continue;
232232
}
233233

234-
$url = object_to_uri( $actor->get_url() ?? $actor->get_id() );
235-
236234
$this->items[] = array(
237235
'id' => $blocked_actor_post->ID,
238-
'icon' => object_to_uri( $actor->get_icon() ?? '' ),
236+
'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ),
239237
'post_title' => $actor->get_name() ?? $actor->get_preferred_username(),
240238
'username' => $actor->get_preferred_username(),
241-
'url' => $url,
239+
'url' => object_to_uri( $actor->get_url() ?? $actor->get_id() ),
242240
'webfinger' => $this->get_webfinger( $actor ),
243241
'identifier' => $actor->get_id(),
244242
'modified' => $blocked_actor_post->post_modified_gmt,

includes/wp-admin/table/class-followers.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,19 +275,16 @@ public function prepare_items() {
275275

276276
foreach ( $followers as $follower ) {
277277
$actor = Actors::get_actor( $follower );
278-
279278
if ( \is_wp_error( $actor ) ) {
280279
continue;
281280
}
282281

283-
$url = object_to_uri( $actor->get_url() ?? $actor->get_id() );
284-
285282
$this->items[] = array(
286283
'id' => $follower->ID,
287-
'icon' => object_to_uri( $actor->get_icon() ?? '' ),
284+
'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ),
288285
'post_title' => $actor->get_name() ?? $actor->get_preferred_username(),
289286
'username' => $actor->get_preferred_username(),
290-
'url' => $url,
287+
'url' => object_to_uri( $actor->get_url() ?? $actor->get_id() ),
291288
'webfinger' => $this->get_webfinger( $actor ),
292289
'identifier' => $actor->get_id(),
293290
'modified' => $follower->post_modified_gmt,

includes/wp-admin/table/class-following.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,19 +256,16 @@ public function prepare_items() {
256256

257257
foreach ( $followings as $following ) {
258258
$actor = Actors::get_actor( $following );
259-
260259
if ( \is_wp_error( $actor ) ) {
261260
continue;
262261
}
263262

264-
$url = object_to_uri( $actor->get_url() ?? $actor->get_id() );
265-
266263
$this->items[] = array(
267264
'id' => $following->ID,
268-
'icon' => object_to_uri( $actor->get_icon() ?? '' ),
265+
'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ),
269266
'post_title' => $actor->get_name() ?? $actor->get_preferred_username(),
270267
'username' => $actor->get_preferred_username(),
271-
'url' => $url,
268+
'url' => object_to_uri( $actor->get_url() ?? $actor->get_id() ),
272269
'webfinger' => $this->get_webfinger( $actor ),
273270
'status' => Following_Collection::check_status( $this->user_id, $following->ID ),
274271
'identifier' => $actor->get_id(),

0 commit comments

Comments
 (0)