fix object handling

This commit is contained in:
Matthias Pfefferle 2023-07-05 15:31:06 +02:00
parent e65b70763d
commit 7a360dbf6f

View file

@ -79,7 +79,7 @@ class Activity extends Base_Object {
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object-term * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object-term
* *
* @var string * @var string
* | ObjectType * | Base_Objectr
* | Link * | Link
* | null * | null
*/ */
@ -173,12 +173,16 @@ class Activity extends Base_Object {
* *
* @see https://www.w3.org/TR/activitypub/#object-without-create * @see https://www.w3.org/TR/activitypub/#object-without-create
* *
* @param \Activitypub\Activity\Base_Object $object * @param string|Base_Objectr|Link|null $object
* *
* @return void * @return void
*/ */
public function set_object( Base_Object $object ) { public function set_object( $object ) {
parent::set_object( $object ); $this->set( 'object', $object );
if ( ! is_object( $object ) ) {
return;
}
foreach ( array( 'to', 'bto', 'cc', 'bcc', 'audience' ) as $i ) { foreach ( array( 'to', 'bto', 'cc', 'bcc', 'audience' ) as $i ) {
$this->set( $i, $object->get( $i ) ); $this->set( $i, $object->get( $i ) );