the browser-facing portion of osu!
at master 35 lines 1.1 kB view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Jobs\Notifications; 7 8use App\Models\Beatmap; 9use App\Models\Notification; 10use App\Models\UserNotificationOption; 11 12class BeatmapsetDisqualify extends BeatmapsetNotification 13{ 14 public function getListeningUserIds(): array 15 { 16 $ids = parent::getListeningUserIds(); 17 18 $modes = $this->beatmapset->playmodes()->all(); 19 $modes = array_map(function ($modeInt) { 20 return Beatmap::modeStr($modeInt); 21 }, $modes); 22 23 UserNotificationOption::where(['name' => Notification::BEATMAPSET_DISQUALIFY]) 24 ->whereNotNull('details') 25 ->chunkById(1000, function ($options) use (&$ids, $modes) { 26 foreach ($options as $option) { 27 if (count(array_intersect($option->details['modes'] ?? [], $modes)) > 0) { 28 $ids[] = $option->user_id; 29 } 30 } 31 }); 32 33 return $ids; 34 } 35}