Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -192,7 +192,7 @@ abstract class _Comment extends \IPS\Content
|
||||
/* Increment post count */
|
||||
try
|
||||
{
|
||||
if ( !$obj->hidden() and ( $incrementPostCount === TRUE or ( $incrementPostCount === NULL and static::incrementPostCount( $item->container() ) ) ) )
|
||||
if ( !$obj->isAnonymous() and !$obj->hidden() and ( $incrementPostCount === TRUE or ( $incrementPostCount === NULL and static::incrementPostCount( $item->container() ) ) ) )
|
||||
{
|
||||
$obj->author()->member_posts++;
|
||||
}
|
||||
@@ -222,12 +222,13 @@ abstract class _Comment extends \IPS\Content
|
||||
$obj->author()->save();
|
||||
}
|
||||
|
||||
/* Send notifications */
|
||||
/* Send notifications and dish out points */
|
||||
if ( !\in_array( 'IPS\Content\Review', class_parents( \get_called_class() ) ) )
|
||||
{
|
||||
if ( !$obj->hidden() and ( !$first or !$item::$firstCommentRequired ) )
|
||||
{
|
||||
$obj->sendNotifications();
|
||||
$obj->author()->achievementAction( 'core', 'Comment', $obj );
|
||||
}
|
||||
else if( $obj->hidden() === 1 )
|
||||
{
|
||||
@@ -298,7 +299,8 @@ abstract class _Comment extends \IPS\Content
|
||||
public function postCreate()
|
||||
{
|
||||
$item = $this->item();
|
||||
|
||||
$itemIdColumn = $item::$databaseColumnId;
|
||||
|
||||
$item->resyncCommentCounts();
|
||||
|
||||
if( isset( static::$databaseColumnMap['date'] ) )
|
||||
@@ -368,6 +370,12 @@ abstract class _Comment extends \IPS\Content
|
||||
{
|
||||
$item->clearCachedStatistics();
|
||||
}
|
||||
|
||||
/* Update mappings */
|
||||
if ( $item->containerWrapper() and \IPS\IPS::classUsesTrait( $item->container(), 'IPS\Node\Statistics' ) )
|
||||
{
|
||||
$item->container()->rebuildPostedIn( array( $item->$itemIdColumn ), array( $this->author() ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -442,7 +450,7 @@ abstract class _Comment extends \IPS\Content
|
||||
$member = \IPS\Member::loggedIn();
|
||||
}
|
||||
|
||||
if ( $this instanceof \IPS\Content\Hideable and $this->hidden() and !$this->item()->canViewHiddenComments( $member ) and ( $this->hidden() !== 1 or $this->author() !== $member ) )
|
||||
if ( $this instanceof \IPS\Content\Hideable and $this->hidden() and !$this->item()->canViewHiddenComments( $member ) and ( $this->hidden() !== 1 or ( $this->author()->member_id AND $this->author() !== $member ) ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -731,7 +739,8 @@ abstract class _Comment extends \IPS\Content
|
||||
public function onHide( $member )
|
||||
{
|
||||
$item = $this->item();
|
||||
|
||||
$itemIdColumn = $item::$databaseColumnId;
|
||||
|
||||
/* Remove any notifications */
|
||||
$idColumn = static::$databaseColumnId;
|
||||
\IPS\Db::i()->delete( 'core_notifications', array( 'item_sub_class=? AND item_sub_id=?', (string) \get_called_class(), (int) $this->$idColumn ) );
|
||||
@@ -749,6 +758,12 @@ abstract class _Comment extends \IPS\Content
|
||||
$item->container()->resetCommentCounts();
|
||||
$item->container()->save();
|
||||
}
|
||||
|
||||
/* Update mappings */
|
||||
if ( \IPS\IPS::classUsesTrait( $item->container(), 'IPS\Node\Statistics' ) )
|
||||
{
|
||||
$item->container()->rebuildPostedIn( array( $item->$itemIdColumn ), array( $this->author() ) );
|
||||
}
|
||||
} catch ( \BadMethodCallException $e ) {}
|
||||
|
||||
if ( \IPS\IPS::classUsesTrait( $item, 'IPS\Content\Statistics' ) )
|
||||
@@ -767,6 +782,7 @@ abstract class _Comment extends \IPS\Content
|
||||
public function onUnhide( $approving, $member )
|
||||
{
|
||||
$item = $this->item();
|
||||
$itemIdColumn = $item::$databaseColumnId;
|
||||
|
||||
if ( $approving )
|
||||
{
|
||||
@@ -799,6 +815,12 @@ abstract class _Comment extends \IPS\Content
|
||||
$item->container()->resetCommentCounts();
|
||||
$item->container()->save();
|
||||
}
|
||||
|
||||
/* Update mappings */
|
||||
if ( \IPS\IPS::classUsesTrait( $item->container(), 'IPS\Node\Statistics' ) )
|
||||
{
|
||||
$item->container()->rebuildPostedIn( array( $item->$itemIdColumn ), array( $this->author() ) );
|
||||
}
|
||||
} catch ( \BadMethodCallException $e ) {}
|
||||
|
||||
if ( \IPS\IPS::classUsesTrait( $item, 'IPS\Content\Statistics' ) )
|
||||
@@ -841,6 +863,9 @@ abstract class _Comment extends \IPS\Content
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_solved_index', array( 'item_id' => $item->$idColumn ), array( 'comment_class=? and comment_id=?', \get_class( $this ), $oldItem->$idColumn ) );
|
||||
}
|
||||
|
||||
/* Update member map */
|
||||
\IPS\Db::i()->update( 'core_item_member_map', array( 'map_item_id' => $item->$idColumn ), array( 'map_class=? and map_item_id=?', \get_class( $oldItem ), $oldItem->$idColumn ) );
|
||||
|
||||
if( $skip === FALSE )
|
||||
{
|
||||
@@ -1004,6 +1029,9 @@ abstract class _Comment extends \IPS\Content
|
||||
/* Actually delete */
|
||||
parent::delete();
|
||||
|
||||
/* Deletions can occur via cron - shut off joining of profile fields as templates and current logged in member object may be referenced. */
|
||||
static::$joinProfileFields = FALSE;
|
||||
|
||||
/* Update last comment/review data for container and item */
|
||||
try
|
||||
{
|
||||
@@ -1041,6 +1069,12 @@ abstract class _Comment extends \IPS\Content
|
||||
}
|
||||
$item->container()->save();
|
||||
}
|
||||
|
||||
/* Update mappings */
|
||||
if ( \IPS\IPS::classUsesTrait( $item->container(), 'IPS\Node\Statistics' ) )
|
||||
{
|
||||
$item->container()->rebuildPostedIn( array( $item->$itemIdColumn ), array( $this->author() ) );
|
||||
}
|
||||
}
|
||||
catch ( \BadMethodCallException $e ) {}
|
||||
}
|
||||
@@ -1509,6 +1543,20 @@ abstract class _Comment extends \IPS\Content
|
||||
|
||||
return $this->sharelinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Web Share Data
|
||||
*
|
||||
* @return array|NULL
|
||||
*/
|
||||
public function webShareData(): ?array
|
||||
{
|
||||
return array(
|
||||
'title' => \IPS\Text\Parser::truncate( $this->item()->mapped('title'), TRUE ),
|
||||
'text' => $this->truncated( TRUE, NULL ),
|
||||
'url' => (string) $this->url()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Addition where needed for fetching comments
|
||||
@@ -1605,4 +1653,26 @@ abstract class _Comment extends \IPS\Content
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'core' )->embedComment( $this->item(), $this, $this->url()->setQueryString( $params ), $this->item()->embedImage() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this an anonymous entry?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAnonymous()
|
||||
{
|
||||
if ( $this instanceof \IPS\Content\Anonymous )
|
||||
{
|
||||
if( $this->isFirst() )
|
||||
{
|
||||
return $this->item()->isAnonymous();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->mapped('is_anon');
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user