Version 4.7.6
This commit is contained in:
1 parent
8ba7d43898
commit
7b7404e741
1085 files changed
+30590
-7837
No files matched your search
@@ -172,6 +172,65 @@ abstract class _Review extends \IPS\Content\Comment
|
||||
}
|
||||
|
||||
$item->save();
|
||||
|
||||
/* Was it moderated? Let's see why. */
|
||||
if ( $this->hidden() === 1 )
|
||||
{
|
||||
$idColumn = static::$databaseColumnId;
|
||||
|
||||
/* Check we don't already have a reason from profanity / url / email filters */
|
||||
try
|
||||
{
|
||||
\IPS\core\Approval::loadFromContent( \get_called_class(), $this->$idColumn );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* If the user is mod-queued - that's why. These will cascade, so check in that order. */
|
||||
$foundReason = FALSE;
|
||||
$log = new \IPS\core\Approval;
|
||||
$log->content_class = \get_called_class();
|
||||
$log->content_id = $this->$idColumn;
|
||||
if ( $this->author()->mod_posts )
|
||||
{
|
||||
|
||||
$log->held_reason = 'user';
|
||||
$foundReason = TRUE;
|
||||
}
|
||||
|
||||
/* If the user isn't mod queued, but is in a group that is, that's why. */
|
||||
if ( $foundReason === FALSE AND $this->author()->group['g_mod_preview'] )
|
||||
{
|
||||
$log->held_reason = 'group';
|
||||
$foundReason = TRUE;
|
||||
}
|
||||
|
||||
/* If the user isn't on mod queue, but the container requires approval, that's why. */
|
||||
if ( $foundReason === FALSE )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( $item->container() AND $item->container()->contentHeldForApprovalByNode( 'review', $this->author() ) === TRUE )
|
||||
{
|
||||
$log->held_reason = 'node';
|
||||
$foundReason = TRUE;
|
||||
}
|
||||
}
|
||||
catch( \BadMethodCallException $e ) { }
|
||||
}
|
||||
|
||||
/* Finally if the item itself requires moderation, that's why */
|
||||
if ( $foundReason === FALSE AND \is_array( $item::supportedMetaDataTypes() ) AND \in_array('core_ItemModeration', $item::supportedMetaDataTypes() ) AND (bool) \IPS\Application::load('core')->extensions( 'core', 'MetaData' )['ItemModeration']->enabled( $item, $this->author() ) )
|
||||
{
|
||||
$log->held_reason = 'item';
|
||||
$foundReason = TRUE;
|
||||
}
|
||||
|
||||
if ( $foundReason )
|
||||
{
|
||||
$log->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user