From da272cdd3b75a3efa756a6d034437e7a35b266e8 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Sat, 22 Jan 2022 12:10:05 +0300 Subject: [PATCH] Issues-662: email massage tweaks for MFE --- Topcoder/class.topcoder.plugin.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Topcoder/class.topcoder.plugin.php b/Topcoder/class.topcoder.plugin.php index d96d2b4..cb1640e 100644 --- a/Topcoder/class.topcoder.plugin.php +++ b/Topcoder/class.topcoder.plugin.php @@ -2387,6 +2387,30 @@ public function profileController_preferences_create($sender, $userReference = ' $sender->_setBreadcrumbs($sender->data('Title'), $sender->canonicalUrl()); $sender->render(); } + + // All notified users have been added in an activity + public function activityModel_BeforeCheckPreference_handler($sender, $args) { + $activity = &$args['Data']; + $notifyUserID = val('NotifyUserID', $activity); + $userModel = new UserModel(); + $user = $userModel->getID($notifyUserID); + $data = $activity['Data']; + $challengeID = $data['ChallengeID']; + if($challengeID) { + $resources = $this->getChallengeResources($challengeID); + $roleResources = $this->getRoleResources(); + $currentProjectRoles = $this->getTopcoderProjectRoles($user, $resources, $roleResources); + if($currentProjectRoles) { + $currentProjectRoles = array_map('strtolower',$currentProjectRoles); + $isClientManager = count(array_intersect($currentProjectRoles, ["client manager"])) > 0; + if($isClientManager) { + $activity['Data']['EmailUrl'] = val('EmbedUrl',$data); + return; + } + } + } + $activity['Data']['EmailUrl'] = externalUrl(val('Route', $activity) == '' ? '/' : val('Route', $activity)); + } } if(!function_exists('topcoderRatingCssClass')) {