*/ class NodeRemovedFromFavoriteListener implements IEventListener { public function __construct( private IActivityManager $activityManager, ) { } public function handle(Event $event):void { if (!($event instanceof NodeRemovedFromFavorite)) { return; } $activityEvent = $this->activityManager->generateEvent(); try { $activityEvent->setApp('files') ->setObject('files', $event->getFileId(), $event->getPath()) ->setType('favorite') ->setAuthor($event->getUser()->getUID()) ->setAffectedUser($event->getUser()->getUID()) ->setTimestamp(time()) ->setSubject( FavoriteProvider::SUBJECT_REMOVED, ['id' => $event->getFileId(), 'path' => $event->getPath()] ); $this->activityManager->publish($activityEvent); } catch (\InvalidArgumentException $e) { } catch (\BadMethodCallException $e) { } } }