mirror of
https://github.com/flarum/core.git
synced 2025-10-27 05:31:29 +01:00
Rework notifications architecture
- The recipient(s) are the concern of the notifier/sender, not the notification itself - Allow “retraction” of notifications (e.g. if a discussion is stickied, but then it is unstickied) - Misc. cleanup
This commit is contained in:
@@ -5,15 +5,15 @@ use DB;
|
||||
|
||||
class EloquentNotificationRepository implements NotificationRepositoryInterface
|
||||
{
|
||||
public function findByUser($userId, $count = null, $start = 0)
|
||||
public function findByUser($userId, $limit = null, $offset = 0)
|
||||
{
|
||||
$primaries = Notification::select(DB::raw('MAX(id) AS id'), DB::raw('SUM(is_read = 0) AS unread_count'))
|
||||
->where('user_id', $userId)
|
||||
->whereIn('type', array_keys(Notification::getTypes()))
|
||||
->groupBy('type', 'subject_id')
|
||||
->orderBy('time', 'desc')
|
||||
->skip($start)
|
||||
->take($count);
|
||||
->skip($offset)
|
||||
->take($limit);
|
||||
|
||||
return Notification::with('subject')
|
||||
->select('notifications.*', 'p.unread_count')
|
||||
|
||||
Reference in New Issue
Block a user