Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -317,6 +317,12 @@ trait Hideable
|
||||
*/
|
||||
public function canRestore( ?Member $member=NULL ): bool
|
||||
{
|
||||
/* Extensions go first */
|
||||
if( $permCheck = Permissions::can( 'restore', $this, $member ) )
|
||||
{
|
||||
return ( $permCheck === Permissions::PERM_ALLOW );
|
||||
}
|
||||
|
||||
if( !$this->actionEnabled( 'restore', $member ) )
|
||||
{
|
||||
return false;
|
||||
@@ -451,16 +457,27 @@ trait Hideable
|
||||
if ( $this instanceof Item )
|
||||
{
|
||||
$item = $this;
|
||||
if( isset( static::$commentClass ) )
|
||||
{
|
||||
$solvedWhere[] = array( 'comment_class=?', static::$commentClass );
|
||||
}
|
||||
|
||||
$solvedWhere[] = array( 'item_id=?', $this->$idColumn );
|
||||
}
|
||||
else
|
||||
{
|
||||
$item = $this->item();
|
||||
$solvedWhere[] = array( 'comment_class=?', get_called_class() );
|
||||
$solvedWhere[] = array( 'comment_id=?', $this->$idColumn );
|
||||
}
|
||||
|
||||
Db::i()->update( 'core_solved_index', [ 'hidden' => 1 ], $solvedWhere );
|
||||
|
||||
if( IPS::classUsesTrait( $item, Helpful::class ) )
|
||||
{
|
||||
$item->recountHelpfuls();
|
||||
}
|
||||
|
||||
/* Update search index */
|
||||
if( SearchContent::isSearchable( $this ) )
|
||||
{
|
||||
@@ -657,16 +674,27 @@ trait Hideable
|
||||
if ( $this instanceof Item )
|
||||
{
|
||||
$item = $this;
|
||||
if( isset( static::$commentClass ) )
|
||||
{
|
||||
$solvedWhere[] = array( 'comment_class=?', static::$commentClass );
|
||||
}
|
||||
|
||||
$solvedWhere[] = array( 'item_id=?', $this->$idColumn );
|
||||
}
|
||||
else
|
||||
{
|
||||
$item = $this->item();
|
||||
$solvedWhere[] = array( 'comment_class=?', get_called_class() );
|
||||
$solvedWhere[] = array( 'comment_id=?', $this->$idColumn );
|
||||
}
|
||||
|
||||
Db::i()->update( 'core_solved_index', [ 'hidden' => 0 ], $solvedWhere );
|
||||
|
||||
if( IPS::classUsesTrait( $item, Helpful::class ) )
|
||||
{
|
||||
$item->recountHelpfuls();
|
||||
}
|
||||
|
||||
/* Clear the item stats */
|
||||
if ( IPS::classUsesTrait( $item, 'IPS\Content\Statistics' ) )
|
||||
{
|
||||
@@ -1373,12 +1401,18 @@ trait Hideable
|
||||
*/
|
||||
public function canHide( ?Member $member=NULL ): bool
|
||||
{
|
||||
/* Extensions go first */
|
||||
if( $permCheck = Permissions::can( 'hide', $this, $member ) )
|
||||
{
|
||||
return ( $permCheck === Permissions::PERM_ALLOW );
|
||||
}
|
||||
|
||||
if( !$this->actionEnabled( 'hide', $member ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $this->hidden() <> 0 )
|
||||
if ( $this->hidden() < 0 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1400,6 +1434,12 @@ trait Hideable
|
||||
*/
|
||||
public function canUnhide( ?Member $member=NULL ): bool
|
||||
{
|
||||
/* Extensions go first */
|
||||
if( $permCheck = Permissions::can( 'unhide', $this, $member ) )
|
||||
{
|
||||
return ( $permCheck === Permissions::PERM_ALLOW );
|
||||
}
|
||||
|
||||
if( !$this->actionEnabled( 'unhide', $member ) )
|
||||
{
|
||||
return false;
|
||||
@@ -1492,7 +1532,13 @@ trait Hideable
|
||||
* @return bool
|
||||
*/
|
||||
public function canViewHiddenComments( ?Member $member=NULL ): bool
|
||||
{
|
||||
{
|
||||
/* Extensions go first */
|
||||
if( $permCheck = Permissions::can( 'view_hidden', $this, $member ) )
|
||||
{
|
||||
return ( $permCheck === Permissions::PERM_ALLOW );
|
||||
}
|
||||
|
||||
$commentClass = static::$commentClass;
|
||||
|
||||
return $commentClass::modPermission( 'view_hidden', $member, $this->containerWrapper() );
|
||||
@@ -1506,6 +1552,12 @@ trait Hideable
|
||||
*/
|
||||
public function canViewHiddenReviews( ?Member $member=NULL ): bool
|
||||
{
|
||||
/* Extensions go first */
|
||||
if( $permCheck = Permissions::can( 'view_hidden', $this, $member ) )
|
||||
{
|
||||
return ( $permCheck === Permissions::PERM_ALLOW );
|
||||
}
|
||||
|
||||
$reviewClass = static::$reviewClass;
|
||||
|
||||
return $reviewClass::modPermission( 'view_hidden', $member, $this->containerWrapper() );
|
||||
|
||||
Reference in new issue
Block a user