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

View File

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

View File

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