Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -100,7 +100,18 @@ class _CommentTopicSync extends \IPS\cms\Records\Comment
|
||||
public function item()
|
||||
{
|
||||
$itemClass = static::$itemClass;
|
||||
return $itemClass::load( \IPS\Request::i()->id );
|
||||
$lookFor = 'IPS\cms\Records\RecordsTopicSync';
|
||||
|
||||
if ( mb_substr( $itemClass, 0, mb_strlen( $lookFor ) ) === $lookFor )
|
||||
{
|
||||
$id = $this->topic_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = \IPS\Request::i()->id;
|
||||
}
|
||||
|
||||
return $itemClass::load( $id );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,19 +121,24 @@ class _CommentTopicSync extends \IPS\cms\Records\Comment
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
parent::delete();
|
||||
|
||||
try
|
||||
{
|
||||
$topic = \IPS\forums\Topic::load( $this->topic_id );
|
||||
$topic->resyncCommentCounts();
|
||||
$topic->resyncLastComment();
|
||||
}
|
||||
catch( \OutOfRangeException $ex )
|
||||
{
|
||||
}
|
||||
/* We need the classname to be \IPS\forums\Topic\Post so topic/forum sync occur and to ensure post is removed from search index */
|
||||
$comment = \IPS\forums\Topic\Post::load( $this->pid );
|
||||
$comment->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Comment Contents - Note: does not add edit log
|
||||
*
|
||||
* @param string $newContent New content
|
||||
* @return string|NULL
|
||||
*/
|
||||
public function editContents( $newContent )
|
||||
{
|
||||
$comment = \IPS\forums\Topic\Post::load( $this->pid );
|
||||
$comment->editContents( $newContent );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Addition where needed for fetching comments
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user