Rename notify classes according the feature name, not the table name
This commit is contained in:
@@ -24,10 +24,10 @@ namespace Friendica\Collection;
|
||||
use Friendica\BaseCollection;
|
||||
use Friendica\Model;
|
||||
|
||||
class Notifies extends BaseCollection
|
||||
class Notifications extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @return Model\Notify
|
||||
* @return Model\Notification
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
+2
-2
@@ -411,11 +411,11 @@ abstract class DI
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Repository\Notify
|
||||
* @return Repository\Notification
|
||||
*/
|
||||
public static function notify()
|
||||
{
|
||||
return self::$dice->create(Repository\Notify::class);
|
||||
return self::$dice->create(Repository\Notification::class);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -56,7 +56,7 @@ class Notification extends BaseFactory
|
||||
{
|
||||
/** @var Database */
|
||||
private $dba;
|
||||
/** @var Repository\Notify */
|
||||
/** @var Repository\Notification */
|
||||
private $notification;
|
||||
/** @var BaseURL */
|
||||
private $baseUrl;
|
||||
@@ -65,7 +65,7 @@ class Notification extends BaseFactory
|
||||
/** @var string */
|
||||
private $nurl;
|
||||
|
||||
public function __construct(LoggerInterface $logger, Database $dba, Repository\Notify $notification, BaseURL $baseUrl, L10n $l10n, App $app, IPConfig $pConfig, ISession $session)
|
||||
public function __construct(LoggerInterface $logger, Database $dba, Repository\Notification $notification, BaseURL $baseUrl, L10n $l10n, App $app, IPConfig $pConfig, ISession $session)
|
||||
{
|
||||
parent::__construct($logger);
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ use Friendica\Core\Worker;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Notify\Type;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\Activity;
|
||||
@@ -2499,12 +2498,12 @@ class Contact
|
||||
|
||||
Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']);
|
||||
|
||||
if (($user['notify-flags'] & Type::INTRO) &&
|
||||
if (($user['notify-flags'] & Notification\Type::INTRO) &&
|
||||
in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL])) {
|
||||
|
||||
notification([
|
||||
'type' => Type::INTRO,
|
||||
'otype' => Notify\ObjectType::INTRO,
|
||||
'type' => Notification\Type::INTRO,
|
||||
'otype' => Notification\ObjectType::INTRO,
|
||||
'verb' => ($sharing ? Activity::FRIEND : Activity::FOLLOW),
|
||||
'uid' => $user['uid'],
|
||||
'cid' => $contact_record['id'],
|
||||
|
||||
@@ -25,7 +25,6 @@ use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Notify\Type;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
@@ -181,8 +180,8 @@ class FContact
|
||||
DBA::insert('intro', $fields);
|
||||
|
||||
notification([
|
||||
'type' => Type::SUGGEST,
|
||||
'otype' => Notify\ObjectType::INTRO,
|
||||
'type' => Notification\Type::SUGGEST,
|
||||
'otype' => Notification\ObjectType::INTRO,
|
||||
'verb' => Activity::REQ_FRIEND,
|
||||
'uid' => $owner['uid'],
|
||||
'cid' => $from_contact['uid'],
|
||||
|
||||
+3
-4
@@ -24,9 +24,8 @@ namespace Friendica\Model;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\DI;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Notify\Type;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Worker\Delivery;
|
||||
@@ -84,8 +83,8 @@ class Mail
|
||||
|
||||
// send notifications.
|
||||
$notif_params = [
|
||||
'type' => Type::MAIL,
|
||||
'otype' => Notify\ObjectType::MAIL,
|
||||
'type' => Notification\Type::MAIL,
|
||||
'otype' => Notification\ObjectType::MAIL,
|
||||
'verb' => Activity::POST,
|
||||
'uid' => $user['uid'],
|
||||
'cid' => $msg['contact-id'],
|
||||
|
||||
@@ -48,13 +48,12 @@ use Psr\Log\LoggerInterface;
|
||||
* @property-read string name_cache Full name of the contact subject
|
||||
* @property-read string msg_cache Plaintext version of the notification text with a placeholder (`{0}`) for the subject contact's name.
|
||||
*/
|
||||
class Notify extends BaseModel
|
||||
class Notification extends BaseModel
|
||||
{
|
||||
|
||||
/** @var \Friendica\Repository\Notify */
|
||||
/** @var \Friendica\Repository\Notification */
|
||||
private $repo;
|
||||
|
||||
public function __construct(Database $dba, LoggerInterface $logger, \Friendica\Repository\Notify $repo, array $data = [])
|
||||
public function __construct(Database $dba, LoggerInterface $logger, \Friendica\Repository\Notification $repo, array $data = [])
|
||||
{
|
||||
parent::__construct($dba, $logger, $data);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Model\Notify;
|
||||
namespace Friendica\Model\Notification;
|
||||
|
||||
/**
|
||||
* Enum for different otypes of the Notify
|
||||
@@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Model\Notify;
|
||||
namespace Friendica\Model\Notification;
|
||||
|
||||
/**
|
||||
* Enum for different types of the Notify
|
||||
@@ -28,7 +28,7 @@ use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Notify\Type;
|
||||
use Friendica\Model\Notification;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException\ForbiddenException;
|
||||
|
||||
@@ -131,7 +131,7 @@ class Delegation extends BaseModule
|
||||
|
||||
$identities[$key]['selected'] = ($identity['nickname'] === DI::app()->user['nickname']);
|
||||
|
||||
$condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Type::INTRO, Type::MAIL];
|
||||
$condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Notification\Type::INTRO, Notification\Type::MAIL];
|
||||
$params = ['distinct' => true, 'expression' => 'parent'];
|
||||
$notifications = DBA::count('notify', $condition, $params);
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ class Register extends BaseModule
|
||||
// send notification to admins
|
||||
while ($admin = DBA::fetch($admins_stmt)) {
|
||||
\notification([
|
||||
'type' => Model\Notify\Type::SYSTEM,
|
||||
'type' => Model\Notification\Type::SYSTEM,
|
||||
'event' => 'SYSTEM_REGISTER_REQUEST',
|
||||
'uid' => $admin['uid'],
|
||||
'link' => $base_url . '/admin/users/',
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Friendica\Object\Api\Friendica;
|
||||
use Friendica\BaseEntity;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Model\Notify;
|
||||
use Friendica\Model\Notification as NotificationModel;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
@@ -78,7 +78,7 @@ class Notification extends BaseEntity
|
||||
/** @var string Message (Plaintext) */
|
||||
protected $msg_plain;
|
||||
|
||||
public function __construct(Notify $notify)
|
||||
public function __construct(NotificationModel $notify)
|
||||
{
|
||||
// map each notify attribute to the entity
|
||||
foreach ($notify->toArray() as $key => $value) {
|
||||
|
||||
@@ -37,8 +37,7 @@ use Friendica\Model\FContact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\ItemURI;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Model\Notify;
|
||||
use Friendica\Model\Notify\Type;
|
||||
use Friendica\Model\Notification;
|
||||
use Friendica\Model\PermissionSet;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Post\Category;
|
||||
@@ -1963,8 +1962,8 @@ class DFRN
|
||||
// send a notification
|
||||
notification(
|
||||
[
|
||||
"type" => Type::POKE,
|
||||
"otype" => Notify\ObjectType::PERSON,
|
||||
"type" => Notification\Type::POKE,
|
||||
"otype" => Notification\ObjectType::PERSON,
|
||||
"activity" => $verb,
|
||||
"verb" => $item["verb"],
|
||||
"uid" => $importer["importer_uid"],
|
||||
|
||||
@@ -30,28 +30,28 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
class Notify extends BaseRepository
|
||||
class Notification extends BaseRepository
|
||||
{
|
||||
protected static $table_name = 'notify';
|
||||
|
||||
protected static $model_class = Model\Notify::class;
|
||||
protected static $model_class = Model\Notification::class;
|
||||
|
||||
protected static $collection_class = Collection\Notifies::class;
|
||||
protected static $collection_class = Collection\Notifications::class;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return Model\Notify
|
||||
* @return Model\Notification
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return new Model\Notify($this->dba, $this->logger, $this, $data);
|
||||
return new Model\Notification($this->dba, $this->logger, $this, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return Collection\Notifies
|
||||
* @return Collection\Notifications
|
||||
*/
|
||||
public function select(array $condition = [], array $params = [])
|
||||
{
|
||||
@@ -66,7 +66,7 @@ class Notify extends BaseRepository
|
||||
* @param int $id The ID of the notify instance
|
||||
* @param int $uid The user ID, bound to this notify instance (= security check)
|
||||
*
|
||||
* @return Model\Notify
|
||||
* @return Model\Notification
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function getByID(int $id, int $uid)
|
||||
@@ -77,14 +77,14 @@ class Notify extends BaseRepository
|
||||
/**
|
||||
* Set seen state of notifications of the local_user()
|
||||
*
|
||||
* @param bool $seen optional true or false. default true
|
||||
* @param Model\Notify $notify optional a notify, which should be set seen (including his parents)
|
||||
* @param bool $seen optional true or false. default true
|
||||
* @param Model\Notification $notify optional a notify, which should be set seen (including his parents)
|
||||
*
|
||||
* @return bool true on success, false on error
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setSeen(bool $seen = true, Model\Notify $notify = null)
|
||||
public function setSeen(bool $seen = true, Model\Notification $notify = null)
|
||||
{
|
||||
if (empty($notify)) {
|
||||
$conditions = ['uid' => local_user()];
|
||||
@@ -102,7 +102,7 @@ class Notify extends BaseRepository
|
||||
/**
|
||||
* @param array $fields
|
||||
*
|
||||
* @return Model\Notify|false
|
||||
* @return Model\Notification|false
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
* @throws Exception
|
||||
Reference in New Issue
Block a user