Fixed wrong Comment date issue in notification mails

This commit is contained in:
buddh4 2017-10-20 20:48:13 +02:00
parent 8bce26e7dc
commit 0b51200b8c
3 changed files with 14 additions and 12 deletions

View File

@ -8,6 +8,7 @@
namespace humhub\modules\comment\models;
use humhub\modules\user\models\User;
use Yii;
use humhub\modules\post\models\Post;
use humhub\modules\content\interfaces\ContentOwner;
@ -105,8 +106,6 @@ class Comment extends ContentAddonActiveRecord implements ContentOwner
/**
* After Saving of comments, fire an activity
*
* @return type
*/
public function afterSave($insert, $changedAttributes)
{
@ -123,6 +122,9 @@ class Comment extends ContentAddonActiveRecord implements ContentOwner
$followers = $this->getCommentedRecord()->getFollowers(null, true);
$this->filterMentionings($followers, $mentionedUsers);
// Update updated_at etc..
$this->refresh();
\humhub\modules\comment\notifications\NewComment::instance()
->from(Yii::$app->user->getIdentity())
->about($this)
@ -140,7 +142,7 @@ class Comment extends ContentAddonActiveRecord implements ContentOwner
$this->updateContentSearch();
return parent::afterSave($insert, $changedAttributes);
parent::afterSave($insert, $changedAttributes);
}
/**

View File

@ -6,12 +6,12 @@
/* @var $isNew boolean */
/* @var $isNew boolean */
/* @var $originator \humhub\modules\user\models\User */
/* @var source yii\db\ActiveRecord */
/* @var contentContainer \humhub\modules\content\components\ContentContainerActiveRecord */
/* @var space humhub\modules\space\models\Space */
/* @var record \humhub\modules\notification\models\Notification */
/* @var html string */
/* @var text string */
/* @var $source yii\db\ActiveRecord */
/* @var $contentContainer \humhub\modules\content\components\ContentContainerActiveRecord */
/* @var $space humhub\modules\space\models\Space */
/* @var $record \humhub\modules\notification\models\Notification */
/* @var $html string */
/* @var $text string */
?>
<?php $this->beginContent('@notification/views/layouts/mail.php', $_params_); ?>
@ -25,7 +25,7 @@
humhub\widgets\mails\MailCommentEntry::widget([
'originator' => $originator,
'comment' => $comment,
'date' => $date,
'date' => $comment->updated_at,
'space' => $space
]);
?>
@ -51,7 +51,7 @@
humhub\widgets\mails\MailContentEntry::widget([
'originator' => $contentRecord->owner,
'content' => $contentRecord,
'date' => $date,
'date' => $contentRecord->content->updated_at,
'space' => $space
]);
?>

View File

@ -202,7 +202,7 @@ class ContentAddonActiveRecord extends ActiveRecord implements ContentOwner
$this->getSource()->content->updateStreamSortTime();
}
return parent::afterSave($insert, $changedAttributes);
parent::afterSave($insert, $changedAttributes);
}
public function getUser()