Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -186,6 +186,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
$existingData = NULL;
|
||||
$existingIndexId = NULL;
|
||||
$resetLastComment = FALSE;
|
||||
$firstCommentId = $this->getFirstCommentId( $object );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -198,7 +199,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
}
|
||||
catch( \Exception $e ) { }
|
||||
|
||||
if ( $object instanceof \IPS\Content\Comment and $existingIndexId and $existingData['index_is_last_comment'] and $indexData['index_is_last_comment'] and $indexData['index_item_id'] and $indexData['index_hidden'] !== 0 )
|
||||
if ( $object instanceof \IPS\Content\Comment and $existingIndexId and $existingData['index_is_last_comment'] and $indexData['index_item_id'] and $indexData['index_hidden'] !== 0 )
|
||||
{
|
||||
/* We do not allow hidden or needing approval comments to become flagged as the last comment as this means users without hidden view permission never see the item in an item only stream */
|
||||
$indexData['index_is_last_comment'] = false;
|
||||
@@ -223,7 +224,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
|
||||
if ( $resetLastComment )
|
||||
{
|
||||
$this->resetLastComment( array( $indexData['index_class'] ), $indexData['index_item_id'] );
|
||||
$this->resetLastComment( array( $indexData['index_class'] ), $indexData['index_item_id'], null, $firstCommentId );
|
||||
}
|
||||
|
||||
/* Views / Comments / Reviews */
|
||||
@@ -415,9 +416,9 @@ class _Index extends \IPS\Content\Search\Index
|
||||
* Retrieve the search ID for an item
|
||||
*
|
||||
* @param \IPS\Content\Searchable $object Item to add
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function getIndexId( \IPS\Content\Searchable $object )
|
||||
public function getIndexId( \IPS\Content\Searchable $object ): string
|
||||
{
|
||||
$databaseColumnId = $object::$databaseColumnId;
|
||||
return \strtolower( str_replace( '\\', '_', \substr( \get_class( $object ), 4 ) ) ) . '-' . $object->$databaseColumnId;
|
||||
@@ -455,7 +456,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
$classes[] = $itemClass::$reviewClass;
|
||||
}
|
||||
|
||||
$this->resetLastComment( $classes, $object->item()->$itemIdColumn, $object->$idColumn );
|
||||
$this->resetLastComment( $classes, $object->item()->$itemIdColumn, $object->$idColumn, $this->getFirstCommentId( $object ) );
|
||||
}
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
@@ -858,16 +859,17 @@ class _Index extends \IPS\Content\Search\Index
|
||||
$this->init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the last comment flag in any given class/index_item_id
|
||||
*
|
||||
* @param array $classes The classes (when first post is required, this is typically just \IPS\forums\Topic\Post but for others, it will be both item and comment classes)
|
||||
* @param int|NULL $indexItemId The index item ID
|
||||
* @param int|NULL $ignoreId ID to ignore because it is being removed
|
||||
* @param int|null $firstCommentId The first comment in this item, used only if $firstCommentRequired
|
||||
* @return void
|
||||
*/
|
||||
public function resetLastComment( $classes, $indexItemId, $ignoreId = NULL )
|
||||
public function resetLastComment( $classes, $indexItemId, $ignoreId = NULL, $firstCommentId = NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -964,7 +966,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
),
|
||||
array(
|
||||
'term' => array(
|
||||
'index_object_id' => $indexItemId
|
||||
'index_object_id' => ( $firstCommentId ?? $indexItemId )
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user