Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wcfsetup/install/files/lib/command/user/Follow.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions wcfsetup/install/files/lib/command/user/SetAvatar.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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));
}
}
4 changes: 4 additions & 0 deletions wcfsetup/install/files/lib/command/user/Unfollow.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -35,6 +37,8 @@ public function __invoke(): void
}

$this->resetUserStorage();

EventHandler::getInstance()->fire(new UserUnfollowed($this->user, $this->target));
}

private function removeActivityEvent(): void
Expand Down
23 changes: 23 additions & 0 deletions wcfsetup/install/files/lib/event/user/AvatarChanged.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace wcf\event\user;

use wcf\data\file\File;
use wcf\data\user\User;
use wcf\event\IPsr14Event;

/**
* Indicates that the avatar of a user has been changed.
*
* @author Marcel Werk
* @copyright 2001-2025 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.2
*/
final class AvatarChanged implements IPsr14Event
{
public function __construct(
public readonly User $user,
public readonly ?File $file
) {}
}
23 changes: 23 additions & 0 deletions wcfsetup/install/files/lib/event/user/CoverPhotoChanged.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace wcf\event\user;

use wcf\data\file\File;
use wcf\data\user\User;
use wcf\event\IPsr14Event;

/**
* Indicates that the cover photo of a user has been changed.
*
* @author Marcel Werk
* @copyright 2001-2025 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.2
*/
final class CoverPhotoChanged implements IPsr14Event
{
public function __construct(
public readonly User $user,
public readonly ?File $file
) {}
}
22 changes: 22 additions & 0 deletions wcfsetup/install/files/lib/event/user/UserFollowed.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace wcf\event\user;

use wcf\data\user\User;
use wcf\event\IPsr14Event;

/**
* Indicates that a user is following another user.
*
* @author Marcel Werk
* @copyright 2001-2025 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.2
*/
final class UserFollowed implements IPsr14Event
{
public function __construct(
public readonly User $user,
public readonly User $target
) {}
}
22 changes: 22 additions & 0 deletions wcfsetup/install/files/lib/event/user/UserUnfollowed.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace wcf\event\user;

use wcf\data\user\User;
use wcf\event\IPsr14Event;

/**
* Indicates that a user is unfollowing another user.
*
* @author Marcel Werk
* @copyright 2001-2025 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.2
*/
final class UserUnfollowed implements IPsr14Event
{
public function __construct(
public readonly User $user,
public readonly User $target
) {}
}
Loading