diff --git a/wcfsetup/install/files/lib/command/user/Follow.class.php b/wcfsetup/install/files/lib/command/user/Follow.class.php index 1a4b0d81db..abce389f3b 100644 --- a/wcfsetup/install/files/lib/command/user/Follow.class.php +++ b/wcfsetup/install/files/lib/command/user/Follow.class.php @@ -5,6 +5,8 @@ use wcf\data\user\follow\UserFollow; use wcf\data\user\follow\UserFollowEditor; use wcf\data\user\User; +use wcf\event\user\UserFollowed; +use wcf\system\event\EventHandler; use wcf\system\user\activity\event\UserActivityEventHandler; use wcf\system\user\notification\object\UserFollowUserNotificationObject; use wcf\system\user\notification\UserNotificationHandler; @@ -40,6 +42,8 @@ public function __invoke(): void $this->sendNotification($follow); $this->fireActivityEvent(); $this->resetUserStorage(); + + EventHandler::getInstance()->fire(new UserFollowed($this->user, $this->target)); } private function sendNotification(UserFollow $follow): void diff --git a/wcfsetup/install/files/lib/command/user/SetAvatar.class.php b/wcfsetup/install/files/lib/command/user/SetAvatar.class.php index 27417ab91e..1d373753e1 100644 --- a/wcfsetup/install/files/lib/command/user/SetAvatar.class.php +++ b/wcfsetup/install/files/lib/command/user/SetAvatar.class.php @@ -6,7 +6,9 @@ use wcf\data\file\FileAction; use wcf\data\user\User; use wcf\data\user\UserEditor; +use wcf\event\user\AvatarChanged; use wcf\system\cache\runtime\UserProfileRuntimeCache; +use wcf\system\event\EventHandler; use wcf\system\user\group\assignment\UserGroupAssignmentHandler; use wcf\system\user\storage\UserStorageHandler; use wcf\system\user\UserProfileHandler; @@ -54,5 +56,7 @@ public function __invoke(): void if ($this->user->userID === WCF::getUser()->userID) { UserProfileHandler::getInstance()->reloadUserProfile(); } + + EventHandler::getInstance()->fire(new AvatarChanged($this->user, $this->file)); } } diff --git a/wcfsetup/install/files/lib/command/user/SetCoverPhoto.class.php b/wcfsetup/install/files/lib/command/user/SetCoverPhoto.class.php index e2fea08879..2f52d5e93f 100644 --- a/wcfsetup/install/files/lib/command/user/SetCoverPhoto.class.php +++ b/wcfsetup/install/files/lib/command/user/SetCoverPhoto.class.php @@ -6,7 +6,9 @@ use wcf\data\file\FileAction; use wcf\data\user\User; use wcf\data\user\UserEditor; +use wcf\event\user\CoverPhotoChanged; use wcf\system\cache\runtime\UserProfileRuntimeCache; +use wcf\system\event\EventHandler; /** * Sets the cover photo of a user. @@ -36,5 +38,7 @@ public function __invoke(): void 'coverPhotoHasWebP' => 0, ]); UserProfileRuntimeCache::getInstance()->removeObject($this->user->userID); + + EventHandler::getInstance()->fire(new CoverPhotoChanged($this->user, $this->file)); } } diff --git a/wcfsetup/install/files/lib/command/user/Unfollow.class.php b/wcfsetup/install/files/lib/command/user/Unfollow.class.php index d00a69b71b..8987a79bd6 100644 --- a/wcfsetup/install/files/lib/command/user/Unfollow.class.php +++ b/wcfsetup/install/files/lib/command/user/Unfollow.class.php @@ -5,6 +5,8 @@ use wcf\data\user\follow\UserFollow; use wcf\data\user\follow\UserFollowEditor; use wcf\data\user\User; +use wcf\event\user\UserUnfollowed; +use wcf\system\event\EventHandler; use wcf\system\user\activity\event\UserActivityEventHandler; use wcf\system\user\storage\UserStorageHandler; @@ -35,6 +37,8 @@ public function __invoke(): void } $this->resetUserStorage(); + + EventHandler::getInstance()->fire(new UserUnfollowed($this->user, $this->target)); } private function removeActivityEvent(): void diff --git a/wcfsetup/install/files/lib/event/user/AvatarChanged.class.php b/wcfsetup/install/files/lib/event/user/AvatarChanged.class.php new file mode 100644 index 0000000000..52834555a1 --- /dev/null +++ b/wcfsetup/install/files/lib/event/user/AvatarChanged.class.php @@ -0,0 +1,23 @@ + + * @since 6.2 + */ +final class AvatarChanged implements IPsr14Event +{ + public function __construct( + public readonly User $user, + public readonly ?File $file + ) {} +} diff --git a/wcfsetup/install/files/lib/event/user/CoverPhotoChanged.class.php b/wcfsetup/install/files/lib/event/user/CoverPhotoChanged.class.php new file mode 100644 index 0000000000..98f556d749 --- /dev/null +++ b/wcfsetup/install/files/lib/event/user/CoverPhotoChanged.class.php @@ -0,0 +1,23 @@ + + * @since 6.2 + */ +final class CoverPhotoChanged implements IPsr14Event +{ + public function __construct( + public readonly User $user, + public readonly ?File $file + ) {} +} diff --git a/wcfsetup/install/files/lib/event/user/UserFollowed.class.php b/wcfsetup/install/files/lib/event/user/UserFollowed.class.php new file mode 100644 index 0000000000..c3d46a7c47 --- /dev/null +++ b/wcfsetup/install/files/lib/event/user/UserFollowed.class.php @@ -0,0 +1,22 @@ + + * @since 6.2 + */ +final class UserFollowed implements IPsr14Event +{ + public function __construct( + public readonly User $user, + public readonly User $target + ) {} +} diff --git a/wcfsetup/install/files/lib/event/user/UserUnfollowed.class.php b/wcfsetup/install/files/lib/event/user/UserUnfollowed.class.php new file mode 100644 index 0000000000..49d0535786 --- /dev/null +++ b/wcfsetup/install/files/lib/event/user/UserUnfollowed.class.php @@ -0,0 +1,22 @@ + + * @since 6.2 + */ +final class UserUnfollowed implements IPsr14Event +{ + public function __construct( + public readonly User $user, + public readonly User $target + ) {} +}