mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
Rename notification.sender
This commit is contained in:
parent
3a21b44a71
commit
f0d296bfb0
|
@ -14,6 +14,6 @@ Object.assign(Notification.prototype, {
|
|||
additionalUnreadCount: computed('unreadCount', unreadCount => Math.max(0, unreadCount - 1)),
|
||||
|
||||
user: Model.hasOne('user'),
|
||||
sender: Model.hasOne('sender'),
|
||||
fromUser: Model.hasOne('fromUser'),
|
||||
subject: Model.hasOne('subject')
|
||||
});
|
||||
|
|
|
@ -20,6 +20,6 @@ export default class DiscussionRenamedNotification extends Notification {
|
|||
}
|
||||
|
||||
content() {
|
||||
return app.translator.trans('core.forum.notifications.discussion_renamed_text', {user: this.props.notification.sender()});
|
||||
return app.translator.trans('core.forum.notifications.discussion_renamed_text', {user: this.props.notification.fromUser()});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export default class Notification extends Component {
|
|||
|
||||
if (!isInitialized) $(element).click(this.markAsRead.bind(this));
|
||||
}}>
|
||||
{avatar(notification.sender())}
|
||||
{avatar(notification.fromUser())}
|
||||
{icon(this.icon(), {className: 'Notification-icon'})}
|
||||
<span className="Notification-content">{this.content()}</span>
|
||||
{humanTime(notification.createdAt())}
|
||||
|
|
|
@ -30,7 +30,7 @@ class ListNotificationsController extends AbstractListController
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public $include = [
|
||||
'sender',
|
||||
'fromUser',
|
||||
'subject',
|
||||
'subject.discussion'
|
||||
];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -32,7 +32,7 @@ class DiscussionRenamedBlueprint implements BlueprintInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSender()
|
||||
public function getFromUser()
|
||||
{
|
||||
return $this->post->user;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue
Block a user