Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -326,50 +326,6 @@ class Post extends Comment implements Embeddable,
|
||||
|
||||
/* !Questions & Answers */
|
||||
|
||||
/**
|
||||
* Can the user rate answers?
|
||||
*
|
||||
* @param int $rating 1 for positive, -1 for negative, 0 for either
|
||||
* @param Member|NULL $member The member (NULL for currently logged in member)
|
||||
* @return bool
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function canVote( int $rating=0, ?Member $member=NULL ) : bool
|
||||
{
|
||||
/* Is $rating valid */
|
||||
if ( !in_array( $rating, array( -1, 0, 1 ) ) )
|
||||
{
|
||||
throw new InvalidArgumentException;
|
||||
}
|
||||
|
||||
/* Downvoting disabled? */
|
||||
if ( $rating === -1 and !Settings::i()->forums_answers_downvote )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Guests can't vote */
|
||||
$member = $member ?: Member::loggedIn();
|
||||
if ( !$member->member_id )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Can't vote your own answers */
|
||||
if ( $member === $this->author() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check the forum settings */
|
||||
if ( $this->item()->container()->qa_rate_answers !== NULL and $this->item()->container()->qa_rate_answers != '*' and !$member->inGroup( explode( ',', $this->item()->container()->qa_rate_answers ) ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom where conditions used specifically for finding comments
|
||||
*
|
||||
@@ -385,17 +341,6 @@ class Post extends Comment implements Embeddable,
|
||||
|
||||
return parent::findCommentWhere();
|
||||
}
|
||||
|
||||
/**
|
||||
* [ActiveRecord] Save
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function save(): void
|
||||
{
|
||||
parent::save();
|
||||
$this->item()->clearVotes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Post
|
||||
|
||||
Reference in new issue
Block a user