1
0
mirror of https://github.com/flarum/core.git synced 2025-08-16 21:34:08 +02:00

Rename notification.sender

This commit is contained in:
Toby Zerner
2018-08-24 21:46:28 +09:30
parent 5c0c2d1c40
commit 9792576464
9 changed files with 10 additions and 10 deletions

View File

@@ -30,7 +30,7 @@ class ListNotificationsController extends AbstractListController
* {@inheritdoc}
*/
public $include = [
'sender',
'fromUser',
'subject',
'subject.discussion'
];

View File

@@ -65,7 +65,7 @@ class NotificationSerializer extends AbstractSerializer
* @param Notification $notification
* @return \Tobscure\JsonApi\Relationship
*/
protected function sender($notification)
protected function fromUser($notification)
{
return $this->hasOne($notification, BasicUserSerializer::class);
}

View File

@@ -23,7 +23,7 @@ interface BlueprintInterface
*
* @return \Flarum\User\User|null
*/
public function getSender();
public function getFromUser();
/**
* Get the model that is the subject of this activity.

View File

@@ -32,7 +32,7 @@ class DiscussionRenamedBlueprint implements BlueprintInterface
/**
* {@inheritdoc}
*/
public function getSender()
public function getFromUser()
{
return $this->post->user;
}

View File

@@ -31,7 +31,7 @@ use Flarum\User\User;
*
* @property int $id
* @property int $user_id
* @property int|null $sender_id
* @property int|null $from_user_id
* @property string $type
* @property int|null $subject_id
* @property mixed|null $data
@@ -39,7 +39,7 @@ use Flarum\User\User;
* @property \Carbon\Carbon $read_at
* @property \Carbon\Carbon $deleted_at
* @property \Flarum\User\User|null $user
* @property \Flarum\User\User|null $sender
* @property \Flarum\User\User|null $fromUser
* @property \Flarum\Database\AbstractModel|null $subject
*/
class Notification extends AbstractModel

View File

@@ -226,7 +226,7 @@ class NotificationSyncer
{
return [
'type' => $blueprint::getType(),
'from_user_id' => ($sender = $blueprint->getSender()) ? $sender->id : null,
'from_user_id' => ($fromUser = $blueprint->getFromUser()) ? $fromUser->id : null,
'subject_id' => ($subject = $blueprint->getSubject()) ? $subject->id : null,
'data' => ($data = $blueprint->getData()) ? json_encode($data) : null
];