1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 10:16:09 +02:00

Fix notifications

This commit is contained in:
Toby Zerner
2015-07-17 14:48:20 +09:30
parent 6fa4d25a5b
commit e3bfa8e404
6 changed files with 97 additions and 7 deletions

View File

@@ -6,8 +6,6 @@ use Flarum\Core\Support\DispatchesEvents;
class ReadNotificationHandler
{
use DispatchesEvents;
/**
* @param ReadNotification $command
* @return Notification
@@ -26,8 +24,6 @@ class ReadNotificationHandler
$notification->read();
$notification->save();
$this->dispatchEventsFor($notification);
return $notification;
}
}

View File

@@ -54,6 +54,6 @@ class DiscussionRenamedBlueprint implements Blueprint
*/
public static function getSubjectModel()
{
return 'Flarum\Core\Models\Discussion';
return 'Flarum\Core\Discussions\Discussion';
}
}

View File

@@ -1,6 +1,7 @@
<?php namespace Flarum\Core\Notifications;
use Flarum\Core\Model;
use Flarum\Core\Support\MappedMorphToTrait;
/**
* Models a notification record in the database.
@@ -20,6 +21,8 @@ use Flarum\Core\Model;
*/
class Notification extends Model
{
use MappedMorphToTrait;
/**
* {@inheritdoc}
*/
@@ -111,7 +114,7 @@ class Notification extends Model
*/
public function subject()
{
return $this->morphTo('subject', 'subjectModel', 'subject_id');
return $this->mappedMorphTo(static::$subjectModels, 'subject', 'type', 'subject_id');
}
/**