diff --git a/js/src/common/models/Notification.js b/js/src/common/models/Notification.js index 8ff48f30d..ad6cff6db 100644 --- a/js/src/common/models/Notification.js +++ b/js/src/common/models/Notification.js @@ -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') }); diff --git a/js/src/forum/components/DiscussionRenamedNotification.js b/js/src/forum/components/DiscussionRenamedNotification.js index d74b7966b..9979d7d4d 100644 --- a/js/src/forum/components/DiscussionRenamedNotification.js +++ b/js/src/forum/components/DiscussionRenamedNotification.js @@ -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()}); } } diff --git a/js/src/forum/components/Notification.js b/js/src/forum/components/Notification.js index 37448b262..7ebc3fc28 100644 --- a/js/src/forum/components/Notification.js +++ b/js/src/forum/components/Notification.js @@ -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'})} {this.content()} {humanTime(notification.createdAt())} diff --git a/src/Api/Controller/ListNotificationsController.php b/src/Api/Controller/ListNotificationsController.php index b1bec9718..8a5a5ef7d 100644 --- a/src/Api/Controller/ListNotificationsController.php +++ b/src/Api/Controller/ListNotificationsController.php @@ -30,7 +30,7 @@ class ListNotificationsController extends AbstractListController * {@inheritdoc} */ public $include = [ - 'sender', + 'fromUser', 'subject', 'subject.discussion' ]; diff --git a/src/Api/Serializer/NotificationSerializer.php b/src/Api/Serializer/NotificationSerializer.php index bf45c87ce..deaeeddbe 100644 --- a/src/Api/Serializer/NotificationSerializer.php +++ b/src/Api/Serializer/NotificationSerializer.php @@ -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); } diff --git a/src/Notification/Blueprint/BlueprintInterface.php b/src/Notification/Blueprint/BlueprintInterface.php index ed8273396..600a8d941 100644 --- a/src/Notification/Blueprint/BlueprintInterface.php +++ b/src/Notification/Blueprint/BlueprintInterface.php @@ -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. diff --git a/src/Notification/Blueprint/DiscussionRenamedBlueprint.php b/src/Notification/Blueprint/DiscussionRenamedBlueprint.php index 50d2e6146..7e79026b9 100644 --- a/src/Notification/Blueprint/DiscussionRenamedBlueprint.php +++ b/src/Notification/Blueprint/DiscussionRenamedBlueprint.php @@ -32,7 +32,7 @@ class DiscussionRenamedBlueprint implements BlueprintInterface /** * {@inheritdoc} */ - public function getSender() + public function getFromUser() { return $this->post->user; } diff --git a/src/Notification/Notification.php b/src/Notification/Notification.php index c36bff190..bf299b035 100644 --- a/src/Notification/Notification.php +++ b/src/Notification/Notification.php @@ -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 diff --git a/src/Notification/NotificationSyncer.php b/src/Notification/NotificationSyncer.php index a8cdd66ab..20bcca6a9 100644 --- a/src/Notification/NotificationSyncer.php +++ b/src/Notification/NotificationSyncer.php @@ -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 ];