Strip bto and bcc before delivery/persisting
This commit is contained in:
parent
ea2ad27ba2
commit
3e34f4743b
@ -12,6 +12,7 @@ function deliver_activity( $activity ) {
|
||||
if ( array_key_exists( 'actor', $activity ) ) {
|
||||
$recipients = remove_actor_inbox_from_recipients( $activity['actor'], $recipients );
|
||||
}
|
||||
$activity = strip_private_fields( $activity );
|
||||
post_activity_to_inboxes( $activity, $recipients );
|
||||
}
|
||||
|
||||
@ -83,4 +84,14 @@ function post_activity_to_inboxes( $activity, $recipients ) {
|
||||
wp_remote_post( $inbox, $args );
|
||||
}
|
||||
}
|
||||
|
||||
function strip_private_fields( $activity ) {
|
||||
if ( array_key_exists( 'bto', $activity ) ) {
|
||||
unset( $activity['bto'] );
|
||||
}
|
||||
if ( array_key_exists( 'bcc', $activity ) ) {
|
||||
unset( $activity['bcc'] );
|
||||
}
|
||||
return $activity;
|
||||
}
|
||||
?>
|
||||
|
@ -81,14 +81,20 @@ function handle_activity( $actor, $activity ) {
|
||||
if ( is_wp_error( $activity ) ) {
|
||||
return $activity;
|
||||
} else {
|
||||
deliver_activity( $activity );
|
||||
$activity = deliver_activity( $activity );
|
||||
return persist_activity( $actor, $activity );
|
||||
}
|
||||
}
|
||||
|
||||
function deliver_activity( $activity ) {
|
||||
// TODO deliver activity, then strip bto and bcc
|
||||
\deliver\deliver_activity( $activity );
|
||||
if ( array_key_exists( 'bto', $activity ) ) {
|
||||
unset( $activity['bto'] );
|
||||
}
|
||||
if ( array_key_exists( 'bcc', $activity ) ) {
|
||||
unset( $activity['bcc'] );
|
||||
}
|
||||
return $activity;
|
||||
}
|
||||
|
||||
function persist_activity( $actor, $activity ) {
|
||||
|
Loading…
Reference in New Issue
Block a user