kopia lustrzana https://github.com/nextcloud/social
				
				
				
			Merge pull request #779 from nextcloud/bugfix/778/count-only-Follow
count only 'Follow'pull/772/head
						commit
						fa5c1c7597
					
				|  | @ -169,8 +169,9 @@ class FollowsRequest extends FollowsRequestBuilder { | |||
| 	 */ | ||||
| 	public function countFollowers(string $actorId): int { | ||||
| 		$qb = $this->countFollowsSelectSql(); | ||||
| 		$this->limitToObjectId($qb, $actorId); | ||||
| 		$this->limitToAccepted($qb, true); | ||||
| 		$qb->limitToObjectId($actorId); | ||||
| 		$qb->limitToType(Follow::TYPE); | ||||
| 		$qb->limitToAccepted(true); | ||||
| 
 | ||||
| 		$cursor = $qb->execute(); | ||||
| 		$data = $cursor->fetch(); | ||||
|  | @ -187,8 +188,9 @@ class FollowsRequest extends FollowsRequestBuilder { | |||
| 	 */ | ||||
| 	public function countFollowing(string $actorId): int { | ||||
| 		$qb = $this->countFollowsSelectSql(); | ||||
| 		$this->limitToActorId($qb, $actorId); | ||||
| 		$this->limitToAccepted($qb, true); | ||||
| 		$qb->limitToActorId($actorId); | ||||
| 		$qb->limitToType(Follow::TYPE); | ||||
| 		$qb->limitToAccepted(true); | ||||
| 
 | ||||
| 		$cursor = $qb->execute(); | ||||
| 		$data = $cursor->fetch(); | ||||
|  |  | |||
|  | @ -97,10 +97,10 @@ class FollowsRequestBuilder extends CoreRequestBuilder { | |||
| 	/** | ||||
| 	 * Base of the Sql Select request for Shares | ||||
| 	 * | ||||
| 	 * @return IQueryBuilder | ||||
| 	 * @return SocialQueryBuilder | ||||
| 	 */ | ||||
| 	protected function countFollowsSelectSql(): IQueryBuilder { | ||||
| 		$qb = $this->dbConnection->getQueryBuilder(); | ||||
| 	protected function countFollowsSelectSql(): SocialQueryBuilder { | ||||
| 		$qb = $this->getQueryBuilder(); | ||||
| 		$qb->selectAlias($qb->createFunction('COUNT(*)'), 'count') | ||||
| 		   ->from(self::TABLE_FOLLOWS, 'f'); | ||||
| 
 | ||||
|  |  | |||
|  | @ -284,8 +284,8 @@ class AccountService { | |||
| 	 */ | ||||
| 	public function addLocalActorDetailCount(Person &$actor) { | ||||
| 		$count = [ | ||||
| 			'followers' => $this->followsRequest->countFollowers($actor->getId()) - 1, | ||||
| 			'following' => $this->followsRequest->countFollowing($actor->getId()) - 1, | ||||
| 			'followers' => $this->followsRequest->countFollowers($actor->getId()), | ||||
| 			'following' => $this->followsRequest->countFollowing($actor->getId()), | ||||
| 			'post'      => $this->streamRequest->countNotesFromActorId($actor->getId()) | ||||
| 		]; | ||||
| 		$actor->setDetailArray('count', $count); | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Maxence Lange
						Maxence Lange