diff --git a/Topcoder/class.topcoder.plugin.php b/Topcoder/class.topcoder.plugin.php
index 63332f0..4d3ef86 100644
--- a/Topcoder/class.topcoder.plugin.php
+++ b/Topcoder/class.topcoder.plugin.php
@@ -2397,27 +2397,86 @@ public function activityModel_BeforeCheckPreference_handler($sender, $args) {
$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);
- $activity['Data']['EmailTemplate'] = 'email-selfservice';
- $category = CategoryModel::categories($challengeID);
- $categoryName = val('Name', $category);
- $headline = 'Message From a Topcoder Member on Your Work - Please See';
- $activity['HeadlineFormat'] = $headline;
- $activity['Headline'] = $headline;
- $activity['Story']= sprintf('A new message has been posted on your work forum tied to your Topcoder Work "%s". You can read the full message below.
-To answer, click "Open Discussion" below to be taken to this discussion.
+ $activityType = $activity['RecordType'];
+ if($activityType == 'Discussion' || $activityType == 'Comment') {
+ $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) {
+ $recordID = $activity['RecordID'];
+ $category = CategoryModel::categories($challengeID);
+ $categoryName = val('Name', $category);
+ $userModel = new UserModel();
+ $discussionModel = new DiscussionModel();
+ if ($activityType == 'Discussion') {
+ $discussion = $discussionModel->getID($recordID);
+ $message = Gdn::formatService()->renderQuote(val('Body', $discussion), val('Format', $discussion));
+ $author = $userModel->getID(val('InsertUserID', $discussion));
+ $dateInserted = Gdn_Format::dateFull(val('DateInserted',$discussion));
+ // $categoryBreadcrumbs = array_column(array_values(CategoryModel::getAncestors(val('CategoryID',$discussion))), 'Name');
+
+ $activity['Story'] =
+ '
A new message has been posted on your work forum tied to your Topcoder Work "' . $categoryName . '" ' . + 'which was updated ' . $dateInserted . ' by ' . $author->Name . ':
' . + 'Discussion: ' . val('Name', $discussion) . '
' . + 'Author: ' . val('Name', $author) . '
' . + // 'Category: ' . implode('›', $categoryBreadcrumbs) . '
' . + 'Message: ' . $message . '
' . + 'To answer, click "Open Discussion" below to be taken to this discussion.
+ Please do not reply to this email.
+ Thank you!
+ The Topcoder Team
A new message has been posted on your work forum tied to your Topcoder Work "' . $categoryName . '" ' . + 'which was updated ' . $commentDateInserted . ' by ' . val('Name',$commentAuthor) . ':
' . + 'Message:'.'
' . + $commentStory . + 'Original Message (by '.$parentCommentAuthor->Name.' ):
'. + '' . + $parentCommentStory. + '
' . + 'To answer, click "Open Discussion" below to be taken to this discussion.
Please do not reply to this email.
Thank you!
-The Topcoder Team', $categoryName);
- return;
- }
+The Topcoder Team