Database changes (#18)

* Update core references

* Update core attribute names
This commit is contained in:
Toby Zerner 2018-09-17 04:20:44 +09:30 committed by Franz Liedke
parent 63ff4b7fc7
commit 3e09c2bf33
6 changed files with 7 additions and 7 deletions

View File

@ -15,6 +15,6 @@ export default class NewPostNotification extends Notification {
}
content() {
return app.translator.trans('flarum-subscriptions.forum.notifications.new_post_text', {user: this.props.notification.sender()});
return app.translator.trans('flarum-subscriptions.forum.notifications.new_post_text', {user: this.props.notification.fromUser()});
}
}

View File

@ -11,6 +11,6 @@
use Flarum\Database\Migration;
return Migration::addColumns('users_discussions', [
return Migration::addColumns('discussion_user', [
'subscription' => ['enum', 'allowed' => ['follow', 'ignore'], 'nullable' => true]
]);

View File

@ -32,7 +32,7 @@ class SubscriptionGambit extends AbstractRegexGambit
$method = $negate ? 'whereNotExists' : 'whereExists';
$search->getQuery()->$method(function ($query) use ($actor, $matches) {
$query->selectRaw('1')
->from('users_discussions')
->from('discussion_user')
->whereColumn('discussions.id', 'discussion_id')
->where('user_id', $actor->id)
->where('subscription', $matches[1] === 'follow' ? 'follow' : 'ignore');

View File

@ -45,7 +45,7 @@ class FilterDiscussionListBySubscription
$actor = $event->search->getActor();
$event->search->getQuery()->whereNotExists(function ($query) use ($actor) {
$query->selectRaw(1)
->from('users_discussions')
->from('discussion_user')
->whereColumn('discussions.id', 'discussion_id')
->where('user_id', $actor->id)
->where('subscription', 'ignore');

View File

@ -68,8 +68,8 @@ class SendNotificationWhenReplyIsPosted
$notify = $discussion->readers()
->where('users.id', '!=', $post->user_id)
->where('users_discussions.subscription', 'follow')
->where('users_discussions.read_number', $discussion->last_post_number - 1)
->where('discussion_user.subscription', 'follow')
->where('discussion_user.last_read_post_number', $discussion->last_post_number - 1)
->get();
$this->notifications->sync(

View File

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