mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Added humhub\modules\comment\models\Comment::flushCommentCache()
This commit is contained in:
parent
7698d9ccf1
commit
adf3eb0ad8
@ -110,8 +110,13 @@ class Comment extends ContentAddonActiveRecord implements ContentOwner
|
||||
*/
|
||||
public function flushCache()
|
||||
{
|
||||
Yii::$app->cache->delete('commentCount_' . $this->object_model . '_' . $this->object_id);
|
||||
Yii::$app->cache->delete('commentsLimited_' . $this->object_model . '_' . $this->object_id);
|
||||
static::flushCommentCache($this->object_model, $this->object_id);
|
||||
}
|
||||
|
||||
public static function flushCommentCache($model, $id)
|
||||
{
|
||||
Yii::$app->cache->delete('commentCount_' . $model . '_' . $id);
|
||||
Yii::$app->cache->delete('commentsLimited_' . $model . '_' . $id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,7 +131,7 @@ class Comment extends ContentAddonActiveRecord implements ContentOwner
|
||||
$this->flushCache();
|
||||
|
||||
// Creating activity
|
||||
NewComment::instance()->about($this)->save();
|
||||
NewComment::instance()->about($this)->create();
|
||||
|
||||
// Handle mentioned users
|
||||
// Execute before NewCommentNotification to avoid double notification when mentioned.
|
||||
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace comment\acceptance;
|
||||
|
||||
use comment\AcceptanceTester;
|
||||
|
||||
class CommentCest
|
||||
{
|
||||
/**
|
||||
* @param AcceptanceTester $I
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testCreateComment(AcceptanceTester $I)
|
||||
{
|
||||
$I->amUser1();
|
||||
$I->amOnSpace2();
|
||||
$I->waitForText('Admin Space 2 Post Private');
|
||||
|
||||
$postEntry = '.wall_humhubmodulespostmodelsPost_13';
|
||||
$commentSection = $postEntry.' .comment-container';
|
||||
|
||||
$I->click('Comment', $postEntry);
|
||||
$I->wait(1);
|
||||
|
||||
$I->click('.btn-comment-submit', $commentSection);
|
||||
|
||||
$I->seeError('The comment must not be empty!');
|
||||
|
||||
$I->fillField($commentSection.' .humhub-ui-richtext[contenteditable]', 'Test comment');
|
||||
|
||||
$I->click('.btn-comment-submit', $commentSection);
|
||||
|
||||
$I->waitForElementVisible('#comment-message-1');
|
||||
$I->see('Test comment','#comment-message-1');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user