From: Marcel Werk Date: Fri, 5 Jun 2020 11:20:54 +0000 (+0200) Subject: Update recent activities when the author of an article changes X-Git-Tag: 5.3.0_Alpha_1~234 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=01ae192e039dc82406a9e730cedc5e952ba00bef;p=GitHub%2FWoltLab%2FWCF.git Update recent activities when the author of an article changes Closes #3356 --- diff --git a/wcfsetup/install/files/lib/data/article/ArticleAction.class.php b/wcfsetup/install/files/lib/data/article/ArticleAction.class.php index e7c80bc22d..874e185665 100644 --- a/wcfsetup/install/files/lib/data/article/ArticleAction.class.php +++ b/wcfsetup/install/files/lib/data/article/ArticleAction.class.php @@ -307,6 +307,22 @@ class ArticleAction extends AbstractDatabaseObjectAction { ArticleEditor::updateArticleCounter($usersToArticles); } } + + // update author in recent activities + if (isset($this->parameters['data']['userID'])) { + $sql = "UPDATE wcf".WCF_N."_user_activity_event SET userID = ? WHERE objectTypeID = ? AND objectID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + + foreach ($this->objects as $articleEditor) { + if ($articleEditor->userID != $this->parameters['data']['userID']) { + $statement->execute([ + $this->parameters['data']['userID'], + UserActivityEventHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.article.recentActivityEvent'), + $articleEditor->articleID, + ]); + } + } + } } /**