Merge pull request #10911 from nupplaphil/feat/depository_fsuggest

Move FSuggest to new paradigm
This commit is contained in:
Hypolite Petovan 2021-10-23 22:04:08 -04:00 committed by GitHub
commit 53402738b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 1114 additions and 820 deletions

View File

@ -1,163 +0,0 @@
<?php
namespace Friendica;
use Exception;
use Friendica\Capabilities\ICanCreateFromTableRow;
use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\Network\HTTPException\NotFoundException;
use Psr\Log\LoggerInterface;
/**
* Depositories are meant to store and retrieve Entities from the database.
*
* The reason why there are methods prefixed with an underscore is because PHP doesn't support generic polymorphism
* which means we can't directly overload base methods and make parameters more strict (from a parent class to a child
* class for example)
*
* Similarly, we can't make an overloaded method return type more strict until we only support PHP version 7.4 but this
* is less pressing.
*/
abstract class BaseDepository
{
const LIMIT = 30;
/**
* @var string This should be set to the main database table name the depository is using
*/
protected static $table_name;
/** @var Database */
protected $db;
/** @var LoggerInterface */
protected $logger;
/** @var ICanCreateFromTableRow */
protected $factory;
public function __construct(Database $database, LoggerInterface $logger, ICanCreateFromTableRow $factory)
{
$this->db = $database;
$this->logger = $logger;
$this->factory = $factory;
}
/**
* Populates the collection according to the condition. Retrieves a limited subset of entities depending on the
* boundaries and the limit. The total count of rows matching the condition is stored in the collection.
*
* Depends on the corresponding table featuring a numerical auto incremented column called `id`.
*
* max_id and min_id are susceptible to the query order:
* - min_id alone only reliably works with ASC order
* - max_id alone only reliably works with DESC order
* If the wrong order is detected in either case, we reverse the query order and the entity list order after the query
*
* Chainable.
*
* @param array $condition
* @param array $params
* @param int|null $min_id Retrieve models with an id no fewer than this, as close to it as possible
* @param int|null $max_id Retrieve models with an id no greater than this, as close to it as possible
* @param int $limit
* @return BaseCollection
* @throws \Exception
*/
protected function _selectByBoundaries(
array $condition = [],
array $params = [],
int $min_id = null,
int $max_id = null,
int $limit = self::LIMIT
): BaseCollection {
$totalCount = $this->count($condition);
$boundCondition = $condition;
$reverseOrder = false;
if (isset($min_id)) {
$boundCondition = DBA::mergeConditions($boundCondition, ['`id` > ?', $min_id]);
if (!isset($max_id) && isset($params['order']['id']) && ($params['order']['id'] === true || $params['order']['id'] === 'DESC')) {
$reverseOrder = true;
$params['order']['id'] = 'ASC';
}
}
if (isset($max_id) && $max_id > 0) {
$boundCondition = DBA::mergeConditions($boundCondition, ['`id` < ?', $max_id]);
if (!isset($min_id) && (!isset($params['order']['id']) || $params['order']['id'] === false || $params['order']['id'] === 'ASC')) {
$reverseOrder = true;
$params['order']['id'] = 'DESC';
}
}
$params['limit'] = $limit;
$Entities = $this->_select($boundCondition, $params);
if ($reverseOrder) {
$Entities->reverse();
}
return new BaseCollection($Entities->getArrayCopy(), $totalCount);
}
/**
* @param array $condition
* @param array $params
* @return BaseCollection
* @throws Exception
*/
protected function _select(array $condition, array $params = []): BaseCollection
{
$rows = $this->db->selectToArray(static::$table_name, [], $condition, $params);
$Entities = new BaseCollection();
foreach ($rows as $fields) {
$Entities[] = $this->factory->createFromTableRow($fields);
}
return $Entities;
}
/**
* @param array $condition
* @param array $params
* @return BaseEntity
* @throws NotFoundException
*/
protected function _selectOne(array $condition, array $params = []): BaseEntity
{
$fields = $this->db->selectFirst(static::$table_name, [], $condition, $params);
if (!$this->db->isResult($fields)) {
throw new NotFoundException();
}
return $this->factory->createFromTableRow($fields);
}
/**
* @param array $condition
* @param array $params
* @return int
* @throws Exception
*/
public function count(array $condition, array $params = []): int
{
return $this->db->count(static::$table_name, $condition, $params);
}
/**
* @param array $condition
* @return bool
* @throws Exception
*/
public function exists(array $condition): bool
{
return $this->db->exists(static::$table_name, $condition);
}
}

View File

@ -21,231 +21,162 @@
namespace Friendica;
use Exception;
use Friendica\Capabilities\ICanCreateFromTableRow;
use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\Network\HTTPException;
use Friendica\Network\HTTPException\NotFoundException;
use Psr\Log\LoggerInterface;
/**
* Repositories are Factories linked to one or more database tables.
* Repositories are meant to store and retrieve Entities from the database.
*
* @see BaseModel
* @see BaseCollection
* The reason why there are methods prefixed with an underscore is because PHP doesn't support generic polymorphism
* which means we can't directly overload base methods and make parameters more strict (from a parent class to a child
* class for example)
*
* Similarly, we can't make an overloaded method return type more strict until we only support PHP version 7.4 but this
* is less pressing.
*/
abstract class BaseRepository extends BaseFactory
abstract class BaseRepository
{
const LIMIT = 30;
/** @var Database */
protected $dba;
/** @var string */
/**
* @var string This should be set to the main database table name the depository is using
*/
protected static $table_name;
/** @var BaseModel */
protected static $model_class;
/** @var Database */
protected $db;
/** @var BaseCollection */
protected static $collection_class;
/** @var LoggerInterface */
protected $logger;
public function __construct(Database $dba, LoggerInterface $logger)
/** @var ICanCreateFromTableRow */
protected $factory;
public function __construct(Database $database, LoggerInterface $logger, ICanCreateFromTableRow $factory)
{
parent::__construct($logger);
$this->dba = $dba;
$this->logger = $logger;
$this->db = $database;
$this->logger = $logger;
$this->factory = $factory;
}
/**
* Fetches a single model record. The condition array is expected to contain a unique index (primary or otherwise).
* Populates the collection according to the condition. Retrieves a limited subset of entities depending on the
* boundaries and the limit. The total count of rows matching the condition is stored in the collection.
*
* Chainable.
*
* @param array $condition
* @return BaseModel
* @throws HTTPException\NotFoundException
*/
public function selectFirst(array $condition)
{
$data = $this->dba->selectFirst(static::$table_name, [], $condition);
if (!$data) {
throw new HTTPException\NotFoundException(static::class . ' record not found.');
}
return $this->create($data);
}
/**
* Populates a Collection according to the condition.
*
* Chainable.
*
* @param array $condition
* @param array $params
* @return BaseCollection
* @throws \Exception
*/
public function select(array $condition = [], array $params = [])
{
$models = $this->selectModels($condition, $params);
return new static::$collection_class($models);
}
/**
* Populates the collection according to the condition. Retrieves a limited subset of models depending on the boundaries
* and the limit. The total count of rows matching the condition is stored in the collection.
* Depends on the corresponding table featuring a numerical auto incremented column called `id`.
*
* max_id and min_id are susceptible to the query order:
* - min_id alone only reliably works with ASC order
* - max_id alone only reliably works with DESC order
* If the wrong order is detected in either case, we inverse the query order and we reverse the model array after the query
* If the wrong order is detected in either case, we reverse the query order and the entity list order after the query
*
* Chainable.
*
* @param array $condition
* @param array $params
* @param int? $min_id Retrieve models with an id no fewer than this, as close to it as possible
* @param int? $max_id Retrieve models with an id no greater than this, as close to it as possible
* @param int $limit
* @param array $condition
* @param array $params
* @param int|null $min_id Retrieve models with an id no fewer than this, as close to it as possible
* @param int|null $max_id Retrieve models with an id no greater than this, as close to it as possible
* @param int $limit
* @return BaseCollection
* @throws \Exception
*/
public function selectByBoundaries(array $condition = [], array $params = [], int $min_id = null, int $max_id = null, int $limit = self::LIMIT)
{
$totalCount = DBA::count(static::$table_name, $condition);
protected function _selectByBoundaries(
array $condition = [],
array $params = [],
int $min_id = null,
int $max_id = null,
int $limit = self::LIMIT
): BaseCollection {
$totalCount = $this->count($condition);
$boundCondition = $condition;
$reverseModels = false;
$reverseOrder = false;
if (isset($min_id)) {
$boundCondition = DBA::mergeConditions($boundCondition, ['`id` > ?', $min_id]);
if (!isset($max_id) && isset($params['order']['id']) && ($params['order']['id'] === true || $params['order']['id'] === 'DESC')) {
$reverseModels = true;
$reverseOrder = true;
$params['order']['id'] = 'ASC';
}
}
if (isset($max_id)) {
if (isset($max_id) && $max_id > 0) {
$boundCondition = DBA::mergeConditions($boundCondition, ['`id` < ?', $max_id]);
if (!isset($min_id) && (!isset($params['order']['id']) || $params['order']['id'] === false || $params['order']['id'] === 'ASC')) {
$reverseModels = true;
$reverseOrder = true;
$params['order']['id'] = 'DESC';
}
}
$params['limit'] = $limit;
$models = $this->selectModels($boundCondition, $params);
if ($reverseModels) {
$models = array_reverse($models);
$Entities = $this->_select($boundCondition, $params);
if ($reverseOrder) {
$Entities->reverse();
}
return new static::$collection_class($models, $totalCount);
return new BaseCollection($Entities->getArrayCopy(), $totalCount);
}
/**
* This method updates the database row from the model.
*
* @param BaseModel $model
* @param array $condition
* @param array $params
* @return BaseCollection
* @throws Exception
*/
protected function _select(array $condition, array $params = []): BaseCollection
{
$rows = $this->db->selectToArray(static::$table_name, [], $condition, $params);
$Entities = new BaseCollection();
foreach ($rows as $fields) {
$Entities[] = $this->factory->createFromTableRow($fields);
}
return $Entities;
}
/**
* @param array $condition
* @param array $params
* @return BaseEntity
* @throws NotFoundException
*/
protected function _selectOne(array $condition, array $params = []): BaseEntity
{
$fields = $this->db->selectFirst(static::$table_name, [], $condition, $params);
if (!$this->db->isResult($fields)) {
throw new NotFoundException();
}
return $this->factory->createFromTableRow($fields);
}
/**
* @param array $condition
* @param array $params
* @return int
* @throws Exception
*/
public function count(array $condition, array $params = []): int
{
return $this->db->count(static::$table_name, $condition, $params);
}
/**
* @param array $condition
* @return bool
* @throws \Exception
* @throws Exception
*/
public function update(BaseModel $model)
public function exists(array $condition): bool
{
if ($this->dba->update(static::$table_name, $model->toArray(), ['id' => $model->id], $model->getOriginalData())) {
$model->resetOriginalData();
return true;
}
return false;
}
/**
* This method creates a new database row and returns a model if it was successful.
*
* @param array $fields
* @return BaseModel|bool
* @throws \Exception
*/
public function insert(array $fields)
{
$return = $this->dba->insert(static::$table_name, $fields);
if (!$return) {
throw new HTTPException\InternalServerErrorException('Unable to insert new row in table "' . static::$table_name . '"');
}
$fields['id'] = $this->dba->lastInsertId();
$return = $this->create($fields);
return $return;
}
/**
* Deletes the model record from the database.
*
* @param BaseModel $model
* @return bool
* @throws \Exception
*/
public function delete(BaseModel &$model)
{
if ($success = $this->dba->delete(static::$table_name, ['id' => $model->id])) {
$model = null;
}
return $success;
}
/**
* Base instantiation method, can be overriden to add specific dependencies
*
* @param array $data
* @return BaseModel
*/
protected function create(array $data)
{
return new static::$model_class($this->dba, $this->logger, $data);
}
/**
* @param array $condition Query condition
* @param array $params Additional query parameters
* @return BaseModel[]
* @throws \Exception
*/
protected function selectModels(array $condition, array $params = [])
{
$result = $this->dba->select(static::$table_name, [], $condition, $params);
/** @var BaseModel $prototype */
$prototype = null;
$models = [];
while ($record = $this->dba->fetch($result)) {
if ($prototype === null) {
$prototype = $this->create($record);
$models[] = $prototype;
} else {
$models[] = static::$model_class::createFromPrototype($prototype, $record);
}
}
$this->dba->close($result);
return $models;
}
/**
* @param BaseCollection $collection
*/
public function saveCollection(BaseCollection $collection)
{
$collection->map([$this, 'update']);
return $this->db->exists(static::$table_name, $condition);
}
}

View File

@ -19,11 +19,10 @@
*
*/
namespace Friendica\Collection;
namespace Friendica\Contact\FriendSuggest\Collection;
use Friendica\BaseCollection;
class FSuggests extends BaseCollection
class FriendSuggests extends BaseCollection
{
}

View File

@ -0,0 +1,83 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Contact\FriendSuggest\Entity;
use Friendica\BaseEntity;
/**
* Model for interacting with a friend suggestion
*
* @property-read int $uid
* @property-read int $cid
* @property-read string $name
* @property-read string $url
* @property-read string $request
* @property-read string $photo
* @property-read string $note
* @property-read \DateTime created
* @property-read int|null $id
*/
class FriendSuggest extends BaseEntity
{
/** @var int */
protected $uid;
/** @var int */
protected $cid;
/** @var string */
protected $name;
/** @var string */
protected $url;
/** @var string */
protected $request;
/** @var string */
protected $photo;
/** @var string */
protected $note;
/** @var \DateTime */
protected $created;
/** @var int|null */
protected $id;
/**
* @param int $uid
* @param int $cid
* @param string $name
* @param string $url
* @param string $request
* @param string $photo
* @param string $note
* @param \DateTime $created
* @param int|null $id
*/
public function __construct(int $uid, int $cid, string $name, string $url, string $request, string $photo, string $note, \DateTime $created, ?int $id = null)
{
$this->uid = $uid;
$this->cid = $cid;
$this->name = $name;
$this->url = $url;
$this->request = $request;
$this->photo = $photo;
$this->note = $note;
$this->created = $created;
$this->id = $id;
}
}

View File

@ -19,23 +19,12 @@
*
*/
namespace Friendica\Model;
namespace Friendica\Contact\FriendSuggest\Exception;
use Friendica\BaseModel;
/**
* Model for interacting with a friend suggestion
*
* @property int uid
* @property int cid
* @property string name
* @property string url
* @property string request
* @property string photo
* @property string note
* @property string created
*/
class FSuggest extends BaseModel
class FriendSuggestNotFoundException extends \OutOfBoundsException
{
public function __construct($message = '', \Throwable $previous = null)
{
parent::__construct($message, 404, $previous);
}
}

View File

@ -19,18 +19,12 @@
*
*/
namespace Friendica\Collection;
namespace Friendica\Contact\FriendSuggest\Exception;
use Friendica\BaseCollection;
use Friendica\Model;
class Notifications extends BaseCollection
class FriendSuggestPersistenceException extends \RuntimeException
{
/**
* @return Model\Notification
*/
public function current()
public function __construct($message = '', \Throwable $previous = null)
{
return parent::current();
parent::__construct($message, 500, $previous);
}
}

View File

@ -0,0 +1,72 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Contact\FriendSuggest\Factory;
use Friendica\BaseFactory;
use Friendica\Capabilities\ICanCreateFromTableRow;
use Friendica\Contact\FriendSuggest\Entity;
class FriendSuggest extends BaseFactory implements ICanCreateFromTableRow
{
/**
* @inheritDoc
*/
public function createFromTableRow(array $row): Entity\FriendSuggest
{
return new Entity\FriendSuggest(
$row['uid'] ?? 0,
$row['cid'] ?? 0,
$row['name'] ?? '',
$row['url'] ?? '',
$row['request'] ?? '',
$row['photo'] ?? '',
$row['note'] ?? '',
new \DateTime($row['created'] ?? 'now', new \DateTimeZone('UTC')),
$row['id'] ?? null
);
}
public function createNew(
int $uid,
int $cid,
string $name = '',
string $url = '',
string $request = '',
string $photo = '',
string $note = ''
): Entity\FriendSuggest {
return $this->createFromTableRow([
'uid' => $uid,
'cid' => $cid,
'name' => $name,
'url' => $url,
'request' => $request,
'photo' => $photo,
'note' => $note,
]);
}
public function createEmpty(int $id): Entity\FriendSuggest
{
return $this->createFromTableRow(['id' => $id]);
}
}

View File

@ -0,0 +1,159 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Contact\FriendSuggest\Repository;
use Friendica\BaseRepository;
use Friendica\Contact\FriendSuggest\Collection;
use Friendica\Contact\FriendSuggest\Entity;
use Friendica\Contact\FriendSuggest\Exception\FriendSuggestNotFoundException;
use Friendica\Contact\FriendSuggest\Exception\FriendSuggestPersistenceException;
use Friendica\Contact\FriendSuggest\Factory;
use Friendica\Database\Database;
use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Util\DateTimeFormat;
use Psr\Log\LoggerInterface;
class FriendSuggest extends BaseRepository
{
/** @var Factory\FriendSuggest */
protected $factory;
protected static $table_name = 'fsuggest';
public function __construct(Database $database, LoggerInterface $logger, Factory\FriendSuggest $factory)
{
parent::__construct($database, $logger, $factory);
}
private function convertToTableRow(Entity\FriendSuggest $fsuggest): array
{
return [
'uid' => $fsuggest->uid,
'cid' => $fsuggest->cid,
'name' => $fsuggest->name,
'url' => $fsuggest->url,
'request' => $fsuggest->request,
'photo' => $fsuggest->photo,
'note' => $fsuggest->note,
'created' => $fsuggest->created->format(DateTimeFormat::MYSQL),
];
}
/**
* @param array $condition
* @param array $params
*
* @return Entity\FriendSuggest
*
* @throws NotFoundException The underlying exception if there's no FriendSuggest with the given conditions
*/
private function selectOne(array $condition, array $params = []): Entity\FriendSuggest
{
return parent::_selectOne($condition, $params);
}
/**
* @param array $condition
* @param array $params
*
* @return Collection\FriendSuggests
*
* @throws \Exception
*/
private function select(array $condition, array $params = []): Collection\FriendSuggests
{
return new Collection\FriendSuggests(parent::_select($condition, $params)->getArrayCopy());
}
/**
* @param int $id
*
* @return Entity\FriendSuggest
*
* @throws FriendSuggestNotFoundException in case there's no suggestion for this id
*/
public function selectOneById(int $id): Entity\FriendSuggest
{
try {
return $this->selectOne(['id' => $id]);
} catch (NotFoundException $e) {
throw new FriendSuggestNotFoundException(sprintf('No FriendSuggest found for id %d', $id));
}
}
/**
* @param int $cid
*
* @return Collection\FriendSuggests
*
* @throws FriendSuggestPersistenceException In case the underlying storage cannot select the suggestion
*/
public function selectForContact(int $cid): Collection\FriendSuggests
{
try {
return $this->select(['cid' => $cid]);
} catch (\Exception $e) {
throw new FriendSuggestPersistenceException(sprintf('Cannot select FriendSuggestion for contact %d', $cid));
}
}
/**
* @param Entity\FriendSuggest $fsuggest
*
* @return Entity\FriendSuggest
*
* @throws FriendSuggestNotFoundException in case the underlying storage cannot save the suggestion
*/
public function save(Entity\FriendSuggest $fsuggest): Entity\FriendSuggest
{
try {
$fields = $this->convertToTableRow($fsuggest);
if ($fsuggest->id) {
$this->db->update(self::$table_name, $fields, ['id' => $fsuggest->id]);
return $this->selectOneById($fsuggest->id);
} else {
$this->db->insert(self::$table_name, $fields);
return $this->selectOneById($this->db->lastInsertId());
}
} catch (\Exception $exception) {
throw new FriendSuggestNotFoundException(sprintf('Cannot insert/update the FriendSuggestion %d for user %d', $fsuggest->id, $fsuggest->uid), $exception);
}
}
/**
* @param Collection\FriendSuggests $fsuggests
*
* @return bool
*
* @throws FriendSuggestNotFoundException in case the underlying storage cannot delete the suggestion
*/
public function delete(Collection\FriendSuggests $fsuggests): bool
{
try {
$ids = $fsuggests->column('id');
return $this->db->delete(self::$table_name, ['id' => $ids]);
} catch (\Exception $exception) {
throw new FriendSuggestNotFoundException('Cannot delete the FriendSuggestions', $exception);
}
}
}

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Contact\Introduction\Collection;

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Contact\Introduction\Exception;

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Contact\Introduction\Exception;

View File

@ -19,9 +19,9 @@
*
*/
namespace Friendica\Contact\Introduction\Depository;
namespace Friendica\Contact\Introduction\Repository;
use Friendica\BaseDepository;
use Friendica\BaseRepository;
use Friendica\Contact\Introduction\Exception\IntroductionNotFoundException;
use Friendica\Contact\Introduction\Exception\IntroductionPersistenceException;
use Friendica\Contact\Introduction\Collection;
@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Util\DateTimeFormat;
use Psr\Log\LoggerInterface;
class Introduction extends BaseDepository
class Introduction extends BaseRepository
{
/** @var Factory\Introduction */
protected $factory;

View File

@ -27,7 +27,7 @@ use Friendica\DI;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
use Friendica\Object\Image;
use Friendica\Security\PermissionSet\Depository\PermissionSet;
use Friendica\Security\PermissionSet\Repository\PermissionSet;
use Friendica\Util\Strings;
use Friendica\Worker\Delivery;

View File

@ -427,19 +427,27 @@ abstract class DI
//
/**
* @return Repository\FSuggest;
* @return Contact\FriendSuggest\Repository\FriendSuggest;
*/
public static function fsuggest()
{
return self::$dice->create(Repository\FSuggest::class);
return self::$dice->create(Contact\FriendSuggest\Repository\FriendSuggest::class);
}
/**
* @return Contact\Introduction\Depository\Introduction
* @return Contact\FriendSuggest\Factory\FriendSuggest;
*/
public static function fsuggestFactory()
{
return self::$dice->create(Contact\FriendSuggest\Factory\FriendSuggest::class);
}
/**
* @return Contact\Introduction\Repository\Introduction
*/
public static function intro()
{
return self::$dice->create(Contact\Introduction\Depository\Introduction::class);
return self::$dice->create(Contact\Introduction\Repository\Introduction::class);
}
/**
@ -450,9 +458,9 @@ abstract class DI
return self::$dice->create(Contact\Introduction\Factory\Introduction::class);
}
public static function permissionSet(): Security\PermissionSet\Depository\PermissionSet
public static function permissionSet(): Security\PermissionSet\Repository\PermissionSet
{
return self::$dice->create(Security\PermissionSet\Depository\PermissionSet::class);
return self::$dice->create(Security\PermissionSet\Repository\PermissionSet::class);
}
public static function permissionSetFactory(): Security\PermissionSet\Factory\PermissionSet
@ -460,9 +468,9 @@ abstract class DI
return self::$dice->create(Security\PermissionSet\Factory\PermissionSet::class);
}
public static function profileField(): Profile\ProfileField\Depository\ProfileField
public static function profileField(): Profile\ProfileField\Repository\ProfileField
{
return self::$dice->create(Profile\ProfileField\Depository\ProfileField::class);
return self::$dice->create(Profile\ProfileField\Repository\ProfileField::class);
}
public static function profileFieldFactory(): Profile\ProfileField\Factory\ProfileField
@ -470,9 +478,9 @@ abstract class DI
return self::$dice->create(Profile\ProfileField\Factory\ProfileField::class);
}
public static function notification(): Navigation\Notifications\Depository\Notification
public static function notification(): Navigation\Notifications\Repository\Notification
{
return self::$dice->create(Navigation\Notifications\Depository\Notification::class);
return self::$dice->create(Navigation\Notifications\Repository\Notification::class);
}
public static function notificationFactory(): Navigation\Notifications\Factory\Notification
@ -480,9 +488,9 @@ abstract class DI
return self::$dice->create(Navigation\Notifications\Factory\Notification::class);
}
public static function notify(): Navigation\Notifications\Depository\Notify
public static function notify(): Navigation\Notifications\Repository\Notify
{
return self::$dice->create(Navigation\Notifications\Depository\Notify::class);
return self::$dice->create(Navigation\Notifications\Repository\Notify::class);
}
public static function notifyFactory(): Navigation\Notifications\Factory\Notify

View File

@ -27,7 +27,7 @@ use Friendica\Collection\Api\Mastodon\Fields;
use Friendica\Model\APContact;
use Friendica\Model\Contact;
use Friendica\Network\HTTPException;
use Friendica\Profile\ProfileField\Depository\ProfileField as ProfileFieldDepository;
use Friendica\Profile\ProfileField\Repository\ProfileField as ProfileFieldRepository;
use ImagickException;
use Psr\Log\LoggerInterface;
@ -35,17 +35,17 @@ class Account extends BaseFactory
{
/** @var BaseURL */
private $baseUrl;
/** @var ProfileFieldDepository */
private $profileFieldDepo;
/** @var ProfileFieldRepository */
private $profileFieldRepo;
/** @var Field */
private $mstdnFieldFactory;
public function __construct(LoggerInterface $logger, BaseURL $baseURL, ProfileFieldDepository $profileFieldDepo, Field $mstdnFieldFactory)
public function __construct(LoggerInterface $logger, BaseURL $baseURL, ProfileFieldRepository $profileFieldRepo, Field $mstdnFieldFactory)
{
parent::__construct($logger);
$this->baseUrl = $baseURL;
$this->profileFieldDepo = $profileFieldDepo;
$this->profileFieldRepo = $profileFieldRepo;
$this->mstdnFieldFactory = $mstdnFieldFactory;
}
@ -76,7 +76,7 @@ class Account extends BaseFactory
$self_contact = Contact::selectFirst(['uid'], ['nurl' => $publicContact['nurl'], 'self' => true]);
if (!empty($self_contact['uid'])) {
$profileFields = $this->profileFieldDepo->selectPublicFieldsByUserId($self_contact['uid']);
$profileFields = $this->profileFieldRepo->selectPublicFieldsByUserId($self_contact['uid']);
$fields = $this->mstdnFieldFactory->createFromProfileFields($profileFields);
} else {
$fields = new Fields();
@ -94,7 +94,7 @@ class Account extends BaseFactory
{
$publicContact = Contact::selectFirst([], ['uid' => $userId, 'self' => true]);
$profileFields = $this->profileFieldDepo->selectPublicFieldsByUserId($userId);
$profileFields = $this->profileFieldRepo->selectPublicFieldsByUserId($userId);
$fields = $this->mstdnFieldFactory->createFromProfileFields($profileFields);
$apContact = APContact::getByURL($publicContact['url'], false);

View File

@ -28,7 +28,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Module\BaseApi;
use Friendica\Network\HTTPException;
use Friendica\Security\PermissionSet\Depository\PermissionSet;
use Friendica\Security\PermissionSet\Repository\PermissionSet;
/**
* API endpoint: /api/friendica/profile/show

View File

@ -68,16 +68,15 @@ class FriendSuggest extends BaseModule
$note = Strings::escapeHtml(trim($_POST['note'] ?? ''));
$suggest = DI::fsuggest()->insert([
'uid' => local_user(),
'cid' => $cid,
'name' => $contact['name'],
'url' => $contact['url'],
'request' => $contact['request'],
'photo' => $contact['avatar'],
'note' => $note,
'created' => DateTimeFormat::utcNow()
]);
$suggest = DI::fsuggest()->save(DI::fsuggestFactory()->createNew(
local_user(),
$cid,
$contact['name'],
$contact['url'],
$contact['request'],
$contact['avatar'],
$note
));
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, $suggest->id);
@ -94,7 +93,7 @@ class FriendSuggest extends BaseModule
DI::baseUrl()->redirect();
}
$contacts = ContactModel::selectToArray(['id', 'name'], [
$suggestableContacts = ContactModel::selectToArray(['id', 'name'], [
'`uid` = ?
AND `id` != ?
AND `network` = ?
@ -111,8 +110,8 @@ class FriendSuggest extends BaseModule
$formattedContacts = [];
foreach ($contacts as $contact) {
$formattedContacts[$contact['id']] = $contact['name'];
foreach ($suggestableContacts as $suggestableContact) {
$formattedContacts[$suggestableContact['id']] = $suggestableContact['name'];
}
$tpl = Renderer::getMarkupTemplate('fsuggest.tpl');

View File

@ -32,7 +32,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Post;
use Friendica\Module\BaseNotifications;
use Friendica\Navigation\Notifications\Collection\FormattedNotifications;
use Friendica\Navigation\Notifications\Depository;
use Friendica\Navigation\Notifications\Repository;
use Friendica\Navigation\Notifications\ValueObject;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Protocol\Activity;
@ -54,14 +54,14 @@ class FormattedNotification extends BaseFactory
{
/** @var Database */
private $dba;
/** @var Depository\Notify */
/** @var Repository\Notify */
private $notify;
/** @var BaseURL */
private $baseUrl;
/** @var L10n */
private $l10n;
public function __construct(LoggerInterface $logger, Database $dba, Depository\Notify $notify, BaseURL $baseUrl, L10n $l10n)
public function __construct(LoggerInterface $logger, Database $dba, Repository\Notify $notify, BaseURL $baseUrl, L10n $l10n)
{
parent::__construct($logger);

View File

@ -1,10 +1,10 @@
<?php
namespace Friendica\Navigation\Notifications\Depository;
namespace Friendica\Navigation\Notifications\Repository;
use Exception;
use Friendica\BaseCollection;
use Friendica\BaseDepository;
use Friendica\BaseRepository;
use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\Model\Verb;
@ -15,7 +15,7 @@ use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Util\DateTimeFormat;
use Psr\Log\LoggerInterface;
class Notification extends BaseDepository
class Notification extends BaseRepository
{
/** @var Factory\Notification */
protected $factory;

View File

@ -1,9 +1,9 @@
<?php
namespace Friendica\Navigation\Notifications\Depository;
namespace Friendica\Navigation\Notifications\Repository;
use Friendica\App\BaseURL;
use Friendica\BaseDepository;
use Friendica\BaseRepository;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Config\IConfig;
use Friendica\Core\Hook;
@ -22,7 +22,7 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer;
use Psr\Log\LoggerInterface;
class Notify extends BaseDepository
class Notify extends BaseRepository
{
/** @var Factory\Notify */
protected $factory;

View File

@ -19,9 +19,9 @@
*
*/
namespace Friendica\Profile\ProfileField\Depository;
namespace Friendica\Profile\ProfileField\Repository;
use Friendica\BaseDepository;
use Friendica\BaseRepository;
use Friendica\Database\Database;
use Friendica\Profile\ProfileField\Exception\ProfileFieldNotFoundException;
use Friendica\Profile\ProfileField\Exception\ProfileFieldPersistenceException;
@ -29,11 +29,11 @@ use Friendica\Profile\ProfileField\Exception\UnexpectedPermissionSetException;
use Friendica\Profile\ProfileField\Factory;
use Friendica\Profile\ProfileField\Entity;
use Friendica\Profile\ProfileField\Collection;
use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository;
use Friendica\Security\PermissionSet\Repository\PermissionSet as PermissionSetRepository;
use Friendica\Util\DateTimeFormat;
use Psr\Log\LoggerInterface;
class ProfileField extends BaseDepository
class ProfileField extends BaseRepository
{
/** @var Factory\ProfileField */
protected $factory;
@ -42,14 +42,14 @@ class ProfileField extends BaseDepository
protected static $view_name = 'profile_field-view';
/** @var PermissionSetDepository */
protected $permissionSetDepository;
/** @var PermissionSetRepository */
protected $permissionSetRepository;
public function __construct(Database $database, LoggerInterface $logger, Factory\ProfileField $factory, PermissionSetDepository $permissionSetDepository)
public function __construct(Database $database, LoggerInterface $logger, Factory\ProfileField $factory, PermissionSetRepository $permissionSetRepository)
{
parent::__construct($database, $logger, $factory);
$this->permissionSetDepository = $permissionSetDepository;
$this->permissionSetRepository = $permissionSetRepository;
}
/**
@ -124,7 +124,7 @@ class ProfileField extends BaseDepository
public function selectPublicFieldsByUserId(int $uid): Collection\ProfileFields
{
try {
$publicPermissionSet = $this->permissionSetDepository->selectPublicForUser($uid);
$publicPermissionSet = $this->permissionSetRepository->selectPublicForUser($uid);
return $this->select([
'uid' => $uid,
@ -162,12 +162,12 @@ class ProfileField extends BaseDepository
*/
public function selectByContactId(int $cid, int $uid): Collection\ProfileFields
{
$permissionSets = $this->permissionSetDepository->selectByContactId($cid, $uid);
$permissionSets = $this->permissionSetRepository->selectByContactId($cid, $uid);
$permissionSetIds = $permissionSets->column('id');
// Includes public custom fields
$permissionSetIds[] = $this->permissionSetDepository->selectPublicForUser($uid)->id;
$permissionSetIds[] = $this->permissionSetRepository->selectPublicForUser($uid)->id;
return $this->select(
['uid' => $uid, 'psid' => $permissionSetIds],

View File

@ -1782,7 +1782,7 @@ class Transmitter
{
$owner = User::getOwnerDataById($uid);
$suggestion = DI::fsuggest()->getById($suggestion_id);
$suggestion = DI::fsuggest()->selectOneById($suggestion_id);
$data = ['@context' => ActivityPub::CONTEXT,
'id' => DI::baseUrl() . '/activity/' . System::createGUID(),

View File

@ -1,93 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Repository;
use Friendica\BaseRepository;
use Friendica\Collection;
use Friendica\Model;
class FSuggest extends BaseRepository
{
protected static $table_name = 'fsuggest';
protected static $model_class = Model\FSuggest::class;
protected static $collection_class = Collection\FSuggests::class;
/**
* @param array $data
* @return Model\FSuggest
*/
protected function create(array $data)
{
return new Model\FSuggest($this->dba, $this->logger, $data);
}
/**
* Returns the Friend Suggest based on it's ID
*
* @param int $id The id of the fsuggest
*
* @return Model\FSuggest
*
* @throws \Friendica\Network\HTTPException\NotFoundException
*/
public function getById(int $id)
{
return $this->selectFirst(['id' => $id]);
}
/**
* @param array $condition
* @return Model\FSuggest
* @throws \Friendica\Network\HTTPException\NotFoundException
*/
public function selectFirst(array $condition)
{
return parent::selectFirst($condition);
}
/**
* @param array $condition
* @param array $params
* @return Collection\FSuggests
* @throws \Exception
*/
public function select(array $condition = [], array $params = [])
{
return parent::select($condition, $params);
}
/**
* @param array $condition
* @param array $params
* @param int|null $min_id
* @param int|null $max_id
* @param int $limit
* @return Collection\FSuggests
* @throws \Exception
*/
public function selectByBoundaries(array $condition = [], array $params = [], int $min_id = null, int $max_id = null, int $limit = self::LIMIT)
{
return parent::selectByBoundaries($condition, $params, $min_id, $max_id, $limit);
}
}

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Security\PermissionSet\Collection;

View File

@ -1,9 +1,28 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Security\PermissionSet\Entity;
use Friendica\BaseEntity;
use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository;
use Friendica\Security\PermissionSet\Repository\PermissionSet as PermissionSetRepository;
/**
* @property-read int|null $id
@ -55,7 +74,7 @@ class PermissionSet extends BaseEntity
*/
public function isPublic(): bool
{
return (($this->id === PermissionSetDepository::PUBLIC) ||
return (($this->id === PermissionSetRepository::PUBLIC) ||
(is_null($this->id) &&
empty($this->allow_cid) &&
empty($this->allow_gid) &&

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Security\PermissionSet\Factory;

View File

@ -19,10 +19,10 @@
*
*/
namespace Friendica\Security\PermissionSet\Depository;
namespace Friendica\Security\PermissionSet\Repository;
use Exception;
use Friendica\BaseDepository;
use Friendica\BaseRepository;
use Friendica\Database\Database;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -33,7 +33,7 @@ use Friendica\Security\PermissionSet\Entity;
use Friendica\Util\ACLFormatter;
use Psr\Log\LoggerInterface;
class PermissionSet extends BaseDepository
class PermissionSet extends BaseRepository
{
/** @var int Virtual permission set id for public permission */
const PUBLIC = 0;

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Security\TwoFactor\Collection;

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Security\TwoFactor\Factory;

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Security\TwoFactor\Model;

View File

@ -1,4 +1,23 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Security\TwoFactor\Repository;

View File

@ -80,7 +80,7 @@ class RemoveContent
DBA::delete('contact-relation', ['relation-cid' => $id]);
DBA::delete('contact-relation', ['cid' => $id]);
DBA::delete('event', ['cid' => $id]);
DBA::delete('fsuggest', ['cid' => $id]);
DI::fsuggest()->delete(DI::fsuggest()->selectForContact($id));
DBA::delete('post-tag', ['cid' => $id]);
DBA::delete('user-contact', ['cid' => $id]);

View File

@ -21,6 +21,8 @@
namespace Friendica\Worker;
use Friendica\Contact\FriendSuggest\Collection\FriendSuggests;
use Friendica\Contact\FriendSuggest\Exception\FriendSuggestNotFoundException;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
@ -64,8 +66,10 @@ class Delivery
}
$uid = $target_item['uid'];
} elseif ($cmd == self::SUGGESTION) {
$target_item = DBA::selectFirst('fsuggest', [], ['id' => $post_uriid]);
if (!DBA::isResult($target_item)) {
try {
$target_item = DI::fsuggest()->selectOneById($post_uriid)->toArray();
} catch (FriendSuggestNotFoundException $e) {
DI::logger()->info('Cannot find FriendSuggestion', ['id' => $post_uriid]);
return;
}
$uid = $target_item['uid'];
@ -209,7 +213,7 @@ class Delivery
// Also transmit via Diaspora if this is a direct answer to a Diaspora comment.
// This is done since the uri wouldn't match (Diaspora doesn't transmit it)
// Also transmit relayed posts from Diaspora contacts via Diaspora.
if (($contact['network'] != Protocol::DIASPORA) && in_array(Protocol::DIASPORA, [$parent['network'] ?? '', $thr_parent['network'] ?? '', $target_item['network']])) {
if (($contact['network'] != Protocol::DIASPORA) && in_array(Protocol::DIASPORA, [$parent['network'] ?? '', $thr_parent['network'] ?? '', $target_item['network']] ?? '')) {
Logger::info('Enforcing the Diaspora protocol', ['id' => $contact['id'], 'network' => $contact['network'], 'parent' => $parent['network'], 'thread-parent' => $thr_parent['network'], 'post' => $target_item['network']]);
$contact['network'] = Protocol::DIASPORA;
}
@ -269,7 +273,7 @@ class Delivery
private static function deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup, $server_protocol)
{
// Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora
if (Diaspora::isReshare($target_item['body']) && !empty(FContact::getByURL($contact['addr'], false))) {
if (Diaspora::isReshare($target_item['body'] ?? '') && !empty(FContact::getByURL($contact['addr'], false))) {
Logger::info('Reshare will be transmitted via Diaspora', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]);
self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
return;
@ -284,7 +288,7 @@ class Delivery
} elseif ($cmd == self::SUGGESTION) {
$item = $target_item;
$atom = DFRN::fsuggest($item, $owner);
DBA::delete('fsuggest', ['id' => $item['id']]);
DI::fsuggest()->delete(new FriendSuggests([DI::fsuggest()->selectOneById($item['id'])]));
} elseif ($cmd == self::RELOCATION) {
$atom = DFRN::relocate($owner, $owner['uid']);
} elseif ($followup) {

View File

@ -90,7 +90,7 @@ class Notifier
'APDelivery', $cmd, $target_id, $inbox, $uid, $receivers, $post_uriid);
}
} elseif ($cmd == Delivery::SUGGESTION) {
$suggest = DI::fsuggest()->getById($target_id);
$suggest = DI::fsuggest()->selectOneById($target_id);
$uid = $suggest->uid;
$recipients[] = $suggest->cid;
} elseif ($cmd == Delivery::REMOVAL) {

View File

@ -0,0 +1,122 @@
<?php
namespace Friendica\Test\src\Contact\FriendSuggest\Factory;
use Friendica\Contact\FriendSuggest\Factory\FriendSuggest;
use Friendica\Contact\FriendSuggest\Entity;
use Friendica\Test\MockedTest;
use Friendica\Util\Logger\VoidLogger;
class FriendSuggestTest extends MockedTest
{
public function dataCreate()
{
return [
'default' => [
'input' => [
'uid' => 12,
'cid' => 13,
'name' => 'test',
'url' => 'https://friendica.local/profile/test',
'request' => 'https://friendica.local/dfrn_request/test',
'photo' => 'https://friendica.local/photo/profile/test',
'note' => 'a common note',
'created' => '2021-10-12 12:23:00'
],
'assertion' => new Entity\FriendSuggest(
12,
13,
'test',
'https://friendica.local/profile/test',
'https://friendica.local/dfrn_request/test',
'https://friendica.local/photo/profile/test',
'a common note',
new \DateTime('2021-10-12 12:23:00', new \DateTimeZone('UTC'))
),
],
'minimum' => [
'input' => [
'id' => 20,
],
'assertion' => new Entity\FriendSuggest(
0,
0,
'',
'',
'',
'',
'',
new \DateTime('now', new \DateTimeZone('URC')),
28
),
],
'full' => [
'input' => [
'uid' => 12,
'cid' => 13,
'name' => 'test',
'url' => 'https://friendica.local/profile/test',
'request' => 'https://friendica.local/dfrn_request/test',
'photo' => 'https://friendica.local/photo/profile/test',
'note' => 'a common note',
'created' => '2021-10-12 12:23:00',
'id' => 666,
],
'assertion' => new Entity\FriendSuggest(
12,
13,
'test',
'https://friendica.local/profile/test',
'https://friendica.local/dfrn_request/test',
'https://friendica.local/photo/profile/test',
'a common note',
new \DateTime('2021-10-12 12:23:00', new \DateTimeZone('UTC')),
666
),
],
];
}
public function assertFriendSuggest(Entity\FriendSuggest $assertion, Entity\FriendSuggest $friendSuggest)
{
self::assertEquals($assertion->id, $friendSuggest->id);
self::assertEquals($assertion->uid, $friendSuggest->uid);
self::assertEquals($assertion->cid, $friendSuggest->cid);
self::assertEquals($assertion->name, $friendSuggest->name);
self::assertEquals($assertion->url, $friendSuggest->url);
self::assertEquals($assertion->request, $friendSuggest->request);
self::assertEquals($assertion->photo, $friendSuggest->photo);
self::assertEquals($assertion->note, $friendSuggest->note);
}
public function testCreateNew()
{
$factory = new FriendSuggest(new VoidLogger());
$this->assertFriendSuggest(
$factory->createNew(12, 13),
new Entity\FriendSuggest(12, 13, '', '', '', '', '',
new \DateTime('now', new \DateTimeZone('UTC')), null
)
);
}
/**
* @dataProvider dataCreate
*/
public function testCreateFromTableRow(array $input, Entity\FriendSuggest $assertion)
{
$factory = new FriendSuggest(new VoidLogger());
$this->assertFriendSuggest($factory->createFromTableRow($input), $assertion);
}
public function testCreateEmpty()
{
$factory = new FriendSuggest(new VoidLogger());
$this->assertFriendSuggest($factory->createEmpty(66), new Entity\FriendSuggest(0, 0, '', '', '', '', '',
new \DateTime('now', new \DateTimeZone('UTC')), 66
));
}
}

View File

@ -6,7 +6,7 @@ use Friendica\Profile\ProfileField\Entity\ProfileField;
use Friendica\Profile\ProfileField\Exception\ProfileFieldNotFoundException;
use Friendica\Profile\ProfileField\Exception\UnexpectedPermissionSetException;
use Friendica\Profile\ProfileField\Factory\ProfileField as ProfileFieldFactory;
use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository;
use Friendica\Security\PermissionSet\Repository\PermissionSet as PermissionSetRepository;
use Friendica\Security\PermissionSet\Factory\PermissionSet as PermissionSetFactory;
use Friendica\Test\MockedTest;
use Friendica\Util\ACLFormatter;
@ -16,8 +16,8 @@ use Mockery\MockInterface;
class ProfileFieldTest extends MockedTest
{
/** @var MockInterface|PermissionSetDepository */
protected $permissionSetDepository;
/** @var MockInterface|PermissionSetRepository */
protected $permissionSetRepository;
/** @var ProfileFieldFactory */
protected $profileFieldFactory;
/** @var MockInterface|PermissionSetFactory */
@ -27,7 +27,7 @@ class ProfileFieldTest extends MockedTest
{
parent::setUp();
$this->permissionSetDepository = \Mockery::mock(PermissionSetDepository::class);
$this->permissionSetRepository = \Mockery::mock(PermissionSetRepository::class);
$this->permissionSetFactory = new PermissionSetFactory(new VoidLogger(), new ACLFormatter());
$this->profileFieldFactory = new ProfileFieldFactory(new VoidLogger(), $this->permissionSetFactory);
}
@ -180,7 +180,7 @@ class ProfileFieldTest extends MockedTest
$permissionSet = $this->permissionSetFactory->createFromTableRow(['uid' => $uid, 'id' => $psid]);
$this->permissionSetDepository->shouldReceive('selectOneById')->with($psid, $uid)->andReturns($permissionSet);
$this->permissionSetRepository->shouldReceive('selectOneById')->with($psid, $uid)->andReturns($permissionSet);
self::assertEquals($psid, $entity->permissionSet->id);
}

View File

@ -1,27 +1,27 @@
<?php
namespace Friendica\Test\src\Profile\ProfileField\Depository;
namespace Friendica\Test\src\Profile\ProfileField\Repository;
use Friendica\Profile\ProfileField\Collection\ProfileFields;
use Friendica\Profile\ProfileField\Depository\ProfileField as ProfileFieldDepository;
use Friendica\Profile\ProfileField\Repository\ProfileField as ProfileFieldRepository;
use Friendica\Profile\ProfileField\Exception\ProfileFieldPersistenceException;
use Friendica\Profile\ProfileField\Factory\ProfileField as ProfileFieldFactory;
use Friendica\Security\PermissionSet\Depository\PermissionSet;
use Friendica\Security\PermissionSet\Repository\PermissionSet;
use Friendica\Security\PermissionSet\Factory\PermissionSet as PermissionSetFactory;
use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository;
use Friendica\Security\PermissionSet\Repository\PermissionSet as PermissionSetRepository;
use Friendica\Test\FixtureTest;
use Friendica\DI;
class ProfileFieldTest extends FixtureTest
{
/** @var ProfileFieldDepository */
/** @var ProfileFieldRepository */
private $depository;
/** @var ProfileFieldFactory */
private $factory;
/** @var PermissionSetFactory */
private $permissionSetFactory;
/** @var PermissionSetDepository */
private $permissionSetDepository;
/** @var PermissionSetRepository */
private $permissionSetRepository;
public function setUp(): void
{
@ -30,7 +30,7 @@ class ProfileFieldTest extends FixtureTest
$this->depository = DI::profileField();
$this->factory = DI::profileFieldFactory();
$this->permissionSetFactory = DI::permissionSetFactory();
$this->permissionSetDepository = DI::permissionSet();
$this->permissionSetRepository = DI::permissionSet();
}
/**
@ -53,7 +53,7 @@ class ProfileFieldTest extends FixtureTest
*/
public function testSaveNew()
{
$profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetDepository->save($this->permissionSetFactory->createFromString(42, '', '<~>')));
$profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetRepository->save($this->permissionSetFactory->createFromString(42, '', '<~>')));
self::assertEquals($profileField->uid, $profileField->permissionSet->uid);
@ -75,7 +75,7 @@ class ProfileFieldTest extends FixtureTest
*/
public function testUpdateOrder()
{
$profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetDepository->save($this->permissionSetFactory->createFromString(42, '', '<~>')));
$profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetRepository->save($this->permissionSetFactory->createFromString(42, '', '<~>')));
self::assertEquals($profileField->uid, $profileField->permissionSet->uid);
@ -108,7 +108,7 @@ class ProfileFieldTest extends FixtureTest
*/
public function testUpdate()
{
$profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetDepository->save($this->permissionSetFactory->createFromString(42, '', '<~>')));
$profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetRepository->save($this->permissionSetFactory->createFromString(42, '', '<~>')));
self::assertEquals($profileField->uid, $profileField->permissionSet->uid);
@ -121,12 +121,12 @@ class ProfileFieldTest extends FixtureTest
self::assertEquals($savedProfileField, $selectedProfileField);
$savedProfileField->update('another', 5, $this->permissionSetDepository->selectPublicForUser(42));
$savedProfileField->update('another', 5, $this->permissionSetRepository->selectPublicForUser(42));
self::assertEquals(PermissionSet::PUBLIC, $savedProfileField->permissionSet->id);
$publicProfileField = $this->depository->save($savedProfileField);
self::assertEquals($this->permissionSetDepository->selectPublicForUser(42), $publicProfileField->permissionSet);
self::assertEquals($this->permissionSetRepository->selectPublicForUser(42), $publicProfileField->permissionSet);
self::assertEquals('another', $publicProfileField->value);
self::assertEquals(5, $publicProfileField->order);

View File

@ -1,8 +1,8 @@
<?php
namespace Friendica\Test\src\Security\PermissionSet\Depository;
namespace Friendica\Test\src\Security\PermissionSet\Repository;
use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository;
use Friendica\Security\PermissionSet\Repository\PermissionSet as PermissionSetRepository;
use Friendica\Security\PermissionSet\Entity\PermissionSet;
use Friendica\Security\PermissionSet\Factory\PermissionSet as PermissionSetFactory;
use Friendica\Test\FixtureTest;
@ -10,8 +10,8 @@ use Friendica\DI;
class PermissionSetTest extends FixtureTest
{
/** @var PermissionSetDepository */
private $depository;
/** @var PermissionSetRepository */
private $repository;
/** @var PermissionSetFactory */
private $factory;
@ -19,20 +19,20 @@ class PermissionSetTest extends FixtureTest
{
parent::setUp();
$this->depository = DI::permissionSet();
$this->repository = DI::permissionSet();
$this->factory = DI::permissionSetFactory();
}
public function testSelectOneByIdPublic()
{
$permissionSet = $this->depository->selectPublicForUser(1);
$permissionSet = $this->repository->selectPublicForUser(1);
$this->assertInstanceOf(PermissionSet::class, $permissionSet);
self::assertEmpty($permissionSet->allow_cid);
self::assertEmpty($permissionSet->allow_gid);
self::assertEmpty($permissionSet->deny_cid);
self::assertEmpty($permissionSet->deny_gid);
self::assertEmpty(PermissionSetDepository::PUBLIC, $permissionSet->id);
self::assertEmpty(PermissionSetRepository::PUBLIC, $permissionSet->id);
self::assertEquals(1, $permissionSet->uid);
}
@ -43,21 +43,21 @@ class PermissionSetTest extends FixtureTest
{
$permissionSet = $this->factory->createFromString(42, '', '<~>');
$permissionSet = $this->depository->selectOrCreate($permissionSet);
$permissionSet = $this->repository->selectOrCreate($permissionSet);
self::assertNotNull($permissionSet->id);
$permissionSetSelected = $this->depository->selectOneById($permissionSet->id, 42);
$permissionSetSelected = $this->repository->selectOneById($permissionSet->id, 42);
self::assertEquals($permissionSet, $permissionSetSelected);
$newPermissionSet = $permissionSet->withAllowedContacts(['1', '2']);
$savedPermissionSet = $this->depository->save($newPermissionSet);
$savedPermissionSet = $this->repository->save($newPermissionSet);
self::assertNotNull($savedPermissionSet->id);
self::assertNull($newPermissionSet->id);
$permissionSetSavedSelected = $this->depository->selectOneById($savedPermissionSet->id, 42);
$permissionSetSavedSelected = $this->repository->selectOneById($savedPermissionSet->id, 42);
self::assertEquals($savedPermissionSet, $permissionSetSavedSelected);
}

View File

@ -55,7 +55,7 @@ use Friendica\Model\Photo;
use Friendica\Model\Post;
use Friendica\Model\Profile;
use Friendica\Model\Storage;
use Friendica\Security\PermissionSet\Depository\PermissionSet;
use Friendica\Security\PermissionSet\Repository\PermissionSet;
use Friendica\Worker\Delivery;
// Post-update script of PR 5751

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2021.12-dev\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-23 17:25+0000\n"
"POT-Creation-Date: 2021-10-23 21:51-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -393,7 +393,7 @@ msgstr ""
#: src/Module/Debug/ActivityPubConversion.php:141
#: src/Module/Debug/Babel.php:313 src/Module/Debug/Localtime.php:64
#: src/Module/Debug/Probe.php:56 src/Module/Debug/WebFinger.php:53
#: src/Module/Delegation.php:147 src/Module/FriendSuggest.php:129
#: src/Module/Delegation.php:147 src/Module/FriendSuggest.php:128
#: src/Module/Install.php:245 src/Module/Install.php:287
#: src/Module/Install.php:324 src/Module/Invite.php:177
#: src/Module/Item/Compose.php:150 src/Module/Profile/Profile.php:247
@ -1114,11 +1114,11 @@ msgstr ""
#: mod/redir.php:55 mod/redir.php:129 src/Module/Contact/Advanced.php:54
#: src/Module/Contact/Advanced.php:105 src/Module/Contact/Contacts.php:36
#: src/Module/Contact/Media.php:43 src/Module/FriendSuggest.php:54
#: src/Module/FriendSuggest.php:93 src/Module/Group.php:105
#: src/Module/FriendSuggest.php:92 src/Module/Group.php:105
msgid "Contact not found."
msgstr ""
#: mod/removeme.php:63 src/Navigation/Notifications/Depository/Notify.php:454
#: mod/removeme.php:63 src/Navigation/Notifications/Repository/Notify.php:454
msgid "[Friendica System Notify]"
msgstr ""
@ -7903,15 +7903,15 @@ msgstr ""
msgid "Suggested contact not found."
msgstr ""
#: src/Module/FriendSuggest.php:84
#: src/Module/FriendSuggest.php:83
msgid "Friend suggestion sent."
msgstr ""
#: src/Module/FriendSuggest.php:121
#: src/Module/FriendSuggest.php:120
msgid "Suggest Friends"
msgstr ""
#: src/Module/FriendSuggest.php:124
#: src/Module/FriendSuggest.php:123
#, php-format
msgid "Suggest a friend for %s"
msgstr ""
@ -9920,262 +9920,6 @@ msgid ""
"features and resources."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:192
#: src/Navigation/Notifications/Depository/Notify.php:675
msgid "[Friendica:Notify]"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:256
#, php-format
msgid "%s New mail received at %s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:258
#, php-format
msgid "%1$s sent you a new private message at %2$s."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:259
msgid "a private message"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:259
#, php-format
msgid "%1$s sent you %2$s."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:261
#, php-format
msgid "Please visit %s to view and/or reply to your private messages."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:292
#, php-format
msgid "%1$s commented on %2$s's %3$s %4$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:297
#, php-format
msgid "%1$s commented on your %2$s %3$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:301
#, php-format
msgid "%1$s commented on their %2$s %3$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:305
#: src/Navigation/Notifications/Depository/Notify.php:710
#, php-format
msgid "%1$s Comment to conversation #%2$d by %3$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:307
#, php-format
msgid "%s commented on an item/conversation you have been following."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:311
#: src/Navigation/Notifications/Depository/Notify.php:326
#: src/Navigation/Notifications/Depository/Notify.php:345
#: src/Navigation/Notifications/Depository/Notify.php:725
#, php-format
msgid "Please visit %s to view and/or reply to the conversation."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:318
#, php-format
msgid "%s %s posted to your profile wall"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:320
#, php-format
msgid "%1$s posted to your profile wall at %2$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:321
#, php-format
msgid "%1$s posted to [url=%2$s]your wall[/url]"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:333
#, php-format
msgid "%1$s %2$s poked you"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:335
#, php-format
msgid "%1$s poked you at %2$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:336
#, php-format
msgid "%1$s [url=%2$s]poked you[/url]."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:353
#, php-format
msgid "%s Introduction received"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:355
#, php-format
msgid "You've received an introduction from '%1$s' at %2$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:356
#, php-format
msgid "You've received [url=%1$s]an introduction[/url] from %2$s."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:361
#: src/Navigation/Notifications/Depository/Notify.php:407
#, php-format
msgid "You may visit their profile at %s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:363
#, php-format
msgid "Please visit %s to approve or reject the introduction."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:370
#, php-format
msgid "%s A new person is sharing with you"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:372
#: src/Navigation/Notifications/Depository/Notify.php:373
#, php-format
msgid "%1$s is sharing with you at %2$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:380
#, php-format
msgid "%s You have a new follower"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:382
#: src/Navigation/Notifications/Depository/Notify.php:383
#, php-format
msgid "You have a new follower at %2$s : %1$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:396
#, php-format
msgid "%s Friend suggestion received"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:398
#, php-format
msgid "You've received a friend suggestion from '%1$s' at %2$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:399
#, php-format
msgid "You've received [url=%1$s]a friend suggestion[/url] for %2$s from %3$s."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:405
msgid "Name:"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:406
msgid "Photo:"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:409
#, php-format
msgid "Please visit %s to approve or reject the suggestion."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:417
#: src/Navigation/Notifications/Depository/Notify.php:432
#, php-format
msgid "%s Connection accepted"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:419
#: src/Navigation/Notifications/Depository/Notify.php:434
#, php-format
msgid "'%1$s' has accepted your connection request at %2$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:420
#: src/Navigation/Notifications/Depository/Notify.php:435
#, php-format
msgid "%2$s has accepted your [url=%1$s]connection request[/url]."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:425
msgid ""
"You are now mutual friends and may exchange status updates, photos, and "
"email without restriction."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:427
#, php-format
msgid "Please visit %s if you wish to make any changes to this relationship."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:440
#, php-format
msgid ""
"'%1$s' has chosen to accept you a fan, which restricts some forms of "
"communication - such as private messaging and some profile interactions. If "
"this is a celebrity or community page, these settings were applied "
"automatically."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:442
#, php-format
msgid ""
"'%1$s' may choose to extend this into a two-way or more permissive "
"relationship in the future."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:444
#, php-format
msgid "Please visit %s if you wish to make any changes to this relationship."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:454
msgid "registration request"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:456
#, php-format
msgid "You've received a registration request from '%1$s' at %2$s"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:457
#, php-format
msgid "You've received a [url=%1$s]registration request[/url] from %2$s."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:462
#, php-format
msgid ""
"Full Name:\t%s\n"
"Site Location:\t%s\n"
"Login Name:\t%s (%s)"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:468
#, php-format
msgid "Please visit %s to approve or reject the request."
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:704
#, php-format
msgid "%s %s tagged you"
msgstr ""
#: src/Navigation/Notifications/Depository/Notify.php:707
#, php-format
msgid "%s %s shared a new post"
msgstr ""
#: src/Navigation/Notifications/Factory/FormattedNotification.php:89
#, php-format
msgid "%s liked %s's post"
@ -10334,6 +10078,262 @@ msgstr ""
msgid "%1$s shared a post"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:192
#: src/Navigation/Notifications/Repository/Notify.php:675
msgid "[Friendica:Notify]"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:256
#, php-format
msgid "%s New mail received at %s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:258
#, php-format
msgid "%1$s sent you a new private message at %2$s."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:259
msgid "a private message"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:259
#, php-format
msgid "%1$s sent you %2$s."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:261
#, php-format
msgid "Please visit %s to view and/or reply to your private messages."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:292
#, php-format
msgid "%1$s commented on %2$s's %3$s %4$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:297
#, php-format
msgid "%1$s commented on your %2$s %3$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:301
#, php-format
msgid "%1$s commented on their %2$s %3$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:305
#: src/Navigation/Notifications/Repository/Notify.php:710
#, php-format
msgid "%1$s Comment to conversation #%2$d by %3$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:307
#, php-format
msgid "%s commented on an item/conversation you have been following."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:311
#: src/Navigation/Notifications/Repository/Notify.php:326
#: src/Navigation/Notifications/Repository/Notify.php:345
#: src/Navigation/Notifications/Repository/Notify.php:725
#, php-format
msgid "Please visit %s to view and/or reply to the conversation."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:318
#, php-format
msgid "%s %s posted to your profile wall"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:320
#, php-format
msgid "%1$s posted to your profile wall at %2$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:321
#, php-format
msgid "%1$s posted to [url=%2$s]your wall[/url]"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:333
#, php-format
msgid "%1$s %2$s poked you"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:335
#, php-format
msgid "%1$s poked you at %2$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:336
#, php-format
msgid "%1$s [url=%2$s]poked you[/url]."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:353
#, php-format
msgid "%s Introduction received"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:355
#, php-format
msgid "You've received an introduction from '%1$s' at %2$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:356
#, php-format
msgid "You've received [url=%1$s]an introduction[/url] from %2$s."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:361
#: src/Navigation/Notifications/Repository/Notify.php:407
#, php-format
msgid "You may visit their profile at %s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:363
#, php-format
msgid "Please visit %s to approve or reject the introduction."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:370
#, php-format
msgid "%s A new person is sharing with you"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:372
#: src/Navigation/Notifications/Repository/Notify.php:373
#, php-format
msgid "%1$s is sharing with you at %2$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:380
#, php-format
msgid "%s You have a new follower"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:382
#: src/Navigation/Notifications/Repository/Notify.php:383
#, php-format
msgid "You have a new follower at %2$s : %1$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:396
#, php-format
msgid "%s Friend suggestion received"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:398
#, php-format
msgid "You've received a friend suggestion from '%1$s' at %2$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:399
#, php-format
msgid "You've received [url=%1$s]a friend suggestion[/url] for %2$s from %3$s."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:405
msgid "Name:"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:406
msgid "Photo:"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:409
#, php-format
msgid "Please visit %s to approve or reject the suggestion."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:417
#: src/Navigation/Notifications/Repository/Notify.php:432
#, php-format
msgid "%s Connection accepted"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:419
#: src/Navigation/Notifications/Repository/Notify.php:434
#, php-format
msgid "'%1$s' has accepted your connection request at %2$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:420
#: src/Navigation/Notifications/Repository/Notify.php:435
#, php-format
msgid "%2$s has accepted your [url=%1$s]connection request[/url]."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:425
msgid ""
"You are now mutual friends and may exchange status updates, photos, and "
"email without restriction."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:427
#, php-format
msgid "Please visit %s if you wish to make any changes to this relationship."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:440
#, php-format
msgid ""
"'%1$s' has chosen to accept you a fan, which restricts some forms of "
"communication - such as private messaging and some profile interactions. If "
"this is a celebrity or community page, these settings were applied "
"automatically."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:442
#, php-format
msgid ""
"'%1$s' may choose to extend this into a two-way or more permissive "
"relationship in the future."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:444
#, php-format
msgid "Please visit %s if you wish to make any changes to this relationship."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:454
msgid "registration request"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:456
#, php-format
msgid "You've received a registration request from '%1$s' at %2$s"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:457
#, php-format
msgid "You've received a [url=%1$s]registration request[/url] from %2$s."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:462
#, php-format
msgid ""
"Full Name:\t%s\n"
"Site Location:\t%s\n"
"Login Name:\t%s (%s)"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:468
#, php-format
msgid "Please visit %s to approve or reject the request."
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:704
#, php-format
msgid "%s %s tagged you"
msgstr ""
#: src/Navigation/Notifications/Repository/Notify.php:707
#, php-format
msgid "%s %s shared a new post"
msgstr ""
#: src/Object/EMail/ItemCCEMail.php:42
#, php-format
msgid ""
@ -10687,7 +10687,7 @@ msgstr ""
msgid "%1$d %2$s ago"
msgstr ""
#: src/Worker/Delivery.php:521
#: src/Worker/Delivery.php:525
msgid "(no subject)"
msgstr ""