kopia lustrzana https://github.com/nextcloud/social
				
				
				
			
							rodzic
							
								
									cf8a326c2d
								
							
						
					
					
						commit
						3cc446aa9d
					
				| 
						 | 
				
			
			@ -54,6 +54,11 @@ use OCP\IRequest;
 | 
			
		|||
use OCP\IUserSession;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class ApiController
 | 
			
		||||
 *
 | 
			
		||||
 * @package OCA\Social\Controller
 | 
			
		||||
 */
 | 
			
		||||
class ApiController extends Controller {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,6 +47,7 @@ use OCA\Social\Service\MiscService;
 | 
			
		|||
use OCP\DB\QueryBuilder\IQueryBuilder;
 | 
			
		||||
use OCP\IDBConnection;
 | 
			
		||||
use OCP\ILogger;
 | 
			
		||||
use OCP\IURLGenerator;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -102,6 +103,9 @@ class CoreRequestBuilder {
 | 
			
		|||
	/** @var ILogger */
 | 
			
		||||
	protected $logger;
 | 
			
		||||
 | 
			
		||||
	/** @var IURLGenerator */
 | 
			
		||||
	protected $urlGenerator;
 | 
			
		||||
 | 
			
		||||
	/** @var IDBConnection */
 | 
			
		||||
	protected $dbConnection;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -123,14 +127,17 @@ class CoreRequestBuilder {
 | 
			
		|||
	 *
 | 
			
		||||
	 * @param IDBConnection $connection
 | 
			
		||||
	 * @param ILogger $logger
 | 
			
		||||
	 * @param IURLGenerator $urlGenerator
 | 
			
		||||
	 * @param ConfigService $configService
 | 
			
		||||
	 * @param MiscService $miscService
 | 
			
		||||
	 */
 | 
			
		||||
	public function __construct(
 | 
			
		||||
		IDBConnection $connection, ILogger $logger, ConfigService $configService, MiscService $miscService
 | 
			
		||||
		IDBConnection $connection, ILogger $logger, IURLGenerator $urlGenerator, ConfigService $configService,
 | 
			
		||||
		MiscService $miscService
 | 
			
		||||
	) {
 | 
			
		||||
		$this->dbConnection = $connection;
 | 
			
		||||
		$this->logger = $logger;
 | 
			
		||||
		$this->urlGenerator = $urlGenerator;
 | 
			
		||||
		$this->configService = $configService;
 | 
			
		||||
		$this->miscService = $miscService;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +150,8 @@ class CoreRequestBuilder {
 | 
			
		|||
		$qb = new SocialQueryBuilder(
 | 
			
		||||
			$this->dbConnection,
 | 
			
		||||
			OC::$server->getSystemConfig(),
 | 
			
		||||
			$this->logger
 | 
			
		||||
			$this->logger,
 | 
			
		||||
			$this->urlGenerator
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		if ($this->viewer !== null) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,7 @@ use OCA\Social\Service\ConfigService;
 | 
			
		|||
use OCA\Social\Service\MiscService;
 | 
			
		||||
use OCP\IDBConnection;
 | 
			
		||||
use OCP\ILogger;
 | 
			
		||||
use OCP\IURLGenerator;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -63,15 +64,16 @@ class StreamDestRequest extends StreamDestRequestBuilder {
 | 
			
		|||
	 *
 | 
			
		||||
	 * @param IDBConnection $connection
 | 
			
		||||
	 * @param ILogger $logger
 | 
			
		||||
	 * @param IURLGenerator $urlGenerator
 | 
			
		||||
	 * @param CacheActorService $cacheActorService
 | 
			
		||||
	 * @param ConfigService $configService
 | 
			
		||||
	 * @param MiscService $miscService
 | 
			
		||||
	 */
 | 
			
		||||
	public function __construct(
 | 
			
		||||
		IDBConnection $connection, ILogger $logger, CacheActorService $cacheActorService,
 | 
			
		||||
		IDBConnection $connection, ILogger $logger, IURLGenerator $urlGenerator, CacheActorService $cacheActorService,
 | 
			
		||||
		ConfigService $configService, MiscService $miscService
 | 
			
		||||
	) {
 | 
			
		||||
		parent::__construct($connection, $logger, $configService, $miscService);
 | 
			
		||||
		parent::__construct($connection, $logger, $urlGenerator, $configService, $miscService);
 | 
			
		||||
 | 
			
		||||
		$this->cacheActorService = $cacheActorService;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,12 +34,10 @@ use daita\MySmallPhpTools\Exceptions\DateTimeException;
 | 
			
		|||
use daita\MySmallPhpTools\Model\Cache;
 | 
			
		||||
use DateTime;
 | 
			
		||||
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
 | 
			
		||||
use Doctrine\DBAL\Query\QueryBuilder;
 | 
			
		||||
use Exception;
 | 
			
		||||
use OCA\Social\Exceptions\ItemUnknownException;
 | 
			
		||||
use OCA\Social\Exceptions\StreamNotFoundException;
 | 
			
		||||
use OCA\Social\Model\ActivityPub\ACore;
 | 
			
		||||
use OCA\Social\Model\ActivityPub\Actor\Person;
 | 
			
		||||
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
 | 
			
		||||
use OCA\Social\Model\ActivityPub\Object\Document;
 | 
			
		||||
use OCA\Social\Model\ActivityPub\Object\Note;
 | 
			
		||||
| 
						 | 
				
			
			@ -49,6 +47,7 @@ use OCA\Social\Service\MiscService;
 | 
			
		|||
use OCP\DB\QueryBuilder\IQueryBuilder;
 | 
			
		||||
use OCP\IDBConnection;
 | 
			
		||||
use OCP\ILogger;
 | 
			
		||||
use OCP\IURLGenerator;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -71,16 +70,18 @@ class StreamRequest extends StreamRequestBuilder {
 | 
			
		|||
	 *
 | 
			
		||||
	 * @param IDBConnection $connection
 | 
			
		||||
	 * @param ILogger $logger
 | 
			
		||||
	 * @param IURLGenerator $urlGenerator
 | 
			
		||||
	 * @param StreamDestRequest $streamDestRequest
 | 
			
		||||
	 * @param StreamTagsRequest $streamTagsRequest
 | 
			
		||||
	 * @param ConfigService $configService
 | 
			
		||||
	 * @param MiscService $miscService
 | 
			
		||||
	 */
 | 
			
		||||
	public function __construct(
 | 
			
		||||
		IDBConnection $connection, ILogger $logger, StreamDestRequest $streamDestRequest,
 | 
			
		||||
		StreamTagsRequest $streamTagsRequest, ConfigService $configService, MiscService $miscService
 | 
			
		||||
		IDBConnection $connection, ILogger $logger, IURLGenerator $urlGenerator,
 | 
			
		||||
		StreamDestRequest $streamDestRequest, StreamTagsRequest $streamTagsRequest,
 | 
			
		||||
		ConfigService $configService, MiscService $miscService
 | 
			
		||||
	) {
 | 
			
		||||
		parent::__construct($connection, $logger, $configService, $miscService);
 | 
			
		||||
		parent::__construct($connection, $logger, $urlGenerator, $configService, $miscService);
 | 
			
		||||
 | 
			
		||||
		$this->streamDestRequest = $streamDestRequest;
 | 
			
		||||
		$this->streamTagsRequest = $streamTagsRequest;
 | 
			
		||||
| 
						 | 
				
			
			@ -721,28 +722,5 @@ class StreamRequest extends StreamRequestBuilder {
 | 
			
		|||
		return $qb;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param IQueryBuilder $qb
 | 
			
		||||
	 * @param Person $actor
 | 
			
		||||
	 *
 | 
			
		||||
	 * @deprecated
 | 
			
		||||
	 */
 | 
			
		||||
	private function leftJoinFollowStatus(IQueryBuilder $qb, Person $actor) {
 | 
			
		||||
		if ($qb->getType() !== QueryBuilder::SELECT) {
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		$expr = $qb->expr();
 | 
			
		||||
		$pf = $qb->getDefaultSelectAlias() . '.';
 | 
			
		||||
 | 
			
		||||
		$on = $expr->andX();
 | 
			
		||||
		$on->add($qb->exprLimitToDBFieldInt('accepted', 1, 'fs'));
 | 
			
		||||
		$on->add($qb->exprLimitToDBField('actor_id_prim', $qb->prim($actor->getId()), true, true, 'fs'));
 | 
			
		||||
		$on->add($expr->eq($pf . 'attributed_to_prim', 'fs.object_id_prim'));
 | 
			
		||||
 | 
			
		||||
		$qb->leftJoin($qb->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_FOLLOWS, 'fs', $on);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -763,12 +763,10 @@ class ACore extends Item implements JsonSerializable {
 | 
			
		|||
		];
 | 
			
		||||
 | 
			
		||||
		if ($this->getNid() > 0) {
 | 
			
		||||
			$result['id'] = $this->getNid();
 | 
			
		||||
			$result['id'] = (string)$this->getNid();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return $result;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -313,7 +313,7 @@ class AccountService {
 | 
			
		|||
		$lastPostCreation = '';
 | 
			
		||||
		try {
 | 
			
		||||
			$lastPost = $this->streamRequest->lastNoteFromActorId($actor->getId());
 | 
			
		||||
			$lastPostCreation = date('y-m-d', $lastPost->getPublishedTime());
 | 
			
		||||
			$lastPostCreation = date('Y-m-d', $lastPost->getPublishedTime());
 | 
			
		||||
		} catch (StreamNotFoundException $e) {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue