Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+36 -1
View File
@@ -94,10 +94,11 @@ abstract class _Review extends \IPS\Content\Comment
$obj->item()->$ratingField = $obj->item()->averageReviewRating() ?: 0;
$obj->item()->save();
/* Send notifications */
/* Send notifications and dish out points */
if ( !$obj->hidden() and ( !$first or !$item::$firstCommentRequired ) )
{
$obj->sendNotifications();
$obj->author()->achievementAction( 'core', 'Review', $obj );
}
else if( $obj->hidden() === 1 )
{
@@ -394,6 +395,40 @@ abstract class _Review extends \IPS\Content\Comment
public function delete()
{
parent::delete();
$this->_recalculateRating();
}
/**
* Log for deletion later
*
* @param \IPS\Member|NULL $member The member, NULL for currently logged in, or FALSE for no member
* @return void
*/
public function logDelete( $member = NULL )
{
parent::logDelete( $member );
$this->_recalculateRating();
}
/**
* Restore Content
*
* @param bool $hidden Restore as hidden?
* @return void
*/
public function restore( $hidden = FALSE )
{
parent::restore( $hidden );
$this->_recalculateRating();
}
/**
* Recalculate rating after review action
*
* @return void
*/
protected function _recalculateRating()
{
$itemClass = static::$itemClass;
$ratingField = $itemClass::$databaseColumnMap['rating'];
$this->item()->$ratingField = $this->item()->averageReviewRating() ?: 0;