From 2b4c9f64e1b1eb03db6a0469f258dd7cff1e8926 Mon Sep 17 00:00:00 2001
From: Bogdanova Olga 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 here to be taken to this discussion. 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:'.' Original Message (by '.$parentCommentAuthor->Name.' ): ' .
+ $parentCommentStory.
+ ' To answer, click here to be taken to this discussion. Category: ' . implode('›', $categoryBreadcrumbs) . ' Message: ' . $message . ' To answer, click here to be taken to this discussion. To answer, click "Open Discussion" below to be taken to this discussion.
-To answer, click here 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'] =
+ '
' .
+ '
'.
+ '
+ Please do not reply to this email.
+ Thank you!
+ The Topcoder Team
';
+
+ } else { // Comment
+ $commentModel = new CommentModel();
+ $comment = $commentModel->getID($recordID);
+ // $discussion = $discussionModel->getID(val('DiscussionID', $comment));
+ // $discussionName = val('Name',$discussion);
+ $commentDateInserted = Gdn_Format::dateFull(val('DateInserted',$comment));
+ $commentAuthor = $userModel->getID(val('InsertUserID',$comment));
+ $commentStory = Gdn::formatService()->renderQuote(val('Body',$comment), val('Format',$comment));
+ $activity['Story'] =
+ '
' .
+ '
';
+
+ $parentCommentID = (int)val('ParentCommentID',$comment);
+ if($parentCommentID > 0) {
+ $parentComment = $commentModel->getID($parentCommentID, DATASET_TYPE_ARRAY);
+ $parentCommentAuthor = $userModel->getID($parentComment['InsertUserID']);
+ $parentCommentStory = condense(Gdn_Format::to($parentComment['Body'], $parentComment['Format']));
+ $activity['Story'] .=
+ '
';
+ }
+ $activity['Story'] .= '
Please do not reply to this email.
Thank you!
-The Topcoder Team', $categoryName);
- return;
- }
+The Topcoder Team
'.
- '
+ '
Please do not reply to this email.
Thank you!
The Topcoder Team
To answer, click here to be taken to this discussion.
+ $activity['Story'] .= '
To answer, click "Open Discussion" below to be taken to this discussion.
Please do not reply to this email.
Thank you!
The Topcoder Team