Skip to content

Commit da272cd

Browse files
committed
Issues-662: email massage tweaks for MFE
1 parent ce71bf1 commit da272cd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Topcoder/class.topcoder.plugin.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2387,6 +2387,30 @@ public function profileController_preferences_create($sender, $userReference = '
23872387
$sender->_setBreadcrumbs($sender->data('Title'), $sender->canonicalUrl());
23882388
$sender->render();
23892389
}
2390+
2391+
// All notified users have been added in an activity
2392+
public function activityModel_BeforeCheckPreference_handler($sender, $args) {
2393+
$activity = &$args['Data'];
2394+
$notifyUserID = val('NotifyUserID', $activity);
2395+
$userModel = new UserModel();
2396+
$user = $userModel->getID($notifyUserID);
2397+
$data = $activity['Data'];
2398+
$challengeID = $data['ChallengeID'];
2399+
if($challengeID) {
2400+
$resources = $this->getChallengeResources($challengeID);
2401+
$roleResources = $this->getRoleResources();
2402+
$currentProjectRoles = $this->getTopcoderProjectRoles($user, $resources, $roleResources);
2403+
if($currentProjectRoles) {
2404+
$currentProjectRoles = array_map('strtolower',$currentProjectRoles);
2405+
$isClientManager = count(array_intersect($currentProjectRoles, ["client manager"])) > 0;
2406+
if($isClientManager) {
2407+
$activity['Data']['EmailUrl'] = val('EmbedUrl',$data);
2408+
return;
2409+
}
2410+
}
2411+
}
2412+
$activity['Data']['EmailUrl'] = externalUrl(val('Route', $activity) == '' ? '/' : val('Route', $activity));
2413+
}
23902414
}
23912415

23922416
if(!function_exists('topcoderRatingCssClass')) {

0 commit comments

Comments
 (0)