Skip to content
Permalink
Browse files

Add body to comment and discussion notifications (#9412)

Add body to comment and discussion notifications
  • Loading branch information
initvector committed Oct 17, 2019
2 parents b46ee75 + 62a7f12 commit 7f30bdf7e45d94774e6e6539664759803b2bbb9a
@@ -567,25 +567,21 @@ private function notifyNewComment(?array $comment, ?array $discussion) {
$data = [
"ActivityType" => "Comment",
"ActivityUserID" => $comment["InsertUserID"] ?? null,
"Format" => $comment["Format"] ?? null,
"HeadlineFormat" => t(
"HeadlineFormat.Comment",
'{ActivityUserID,user} commented on <a href="{Url,html}">{Data.Name,text}</a>'
),
"RecordType" => "Comment",
"RecordID" => $commentID,
"Route" => "/discussion/comment/{$commentID}#Comment_{$commentID}",
"Story" => $comment["Body"] ?? null,
"Data" => [
"Name" => $discussion["Name"] ?? null,
"Category" => $category["Name"] ?? null,
]
];

// Allow simple fulltext notifications
if (c("Vanilla.Activity.ShowCommentBody", false)) {
$data["Story"] = $comment["Body"] ?? null;
$data["Format"] = $comment["Format"] ?? null;
}

// Pass generic activity to events.
$this->EventArguments["Activity"] = $data;

@@ -2267,25 +2267,21 @@ public function notifyNewDiscussion($discussion, $activityModel = null, $activit
$data = [
"ActivityType" => "Discussion",
"ActivityUserID" => $insertUserID,
"Format" => $format ?? null,
"HeadlineFormat" => t(
$code,
'{ActivityUserID,user} started a new discussion: <a href="{Url,html}">{Data.Name,text}</a>'
),
"RecordType" => "Discussion",
"RecordID" => $discussionID,
"Route" => discussionUrl($discussion, "", "/"),
"Story" => $body ?? null,
"Data" => [
"Name" => $name,
"Category" => $categoryName,
]
];

// Allow simple fulltext notifications
if (c("Vanilla.Activity.ShowDiscussionBody", false)) {
$data["Story"] = $body;
$data["Format"] = $format;
}

// Notify all of the users that were mentioned in the discussion.
$mentions = [];
if (is_string($body) && is_string($format)) {

0 comments on commit 7f30bdf

Please sign in to comment.
You can’t perform that action at this time.