Skip to content

Commit

Permalink
Merge branch 'master' into team-profile-page
Browse files Browse the repository at this point in the history
  • Loading branch information
notbakaneko authored Dec 11, 2024
2 parents 4528afe + a1ab778 commit 703442b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 29 deletions.
47 changes: 26 additions & 21 deletions app/Http/Controllers/Chat/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,39 +89,44 @@ public function ack()
* @bodyParam uuid string client-side message identifier which will be sent back in response and websocket json. Example: some-uuid-string
*
* @response {
* "channel": [
* {
* "channel_id": 1234,
* "current_user_attributes": {
* "can_message": true,
* "can_message_error": null,
* "last_read_id": 9150005005
* },
* "name": "peppy",
* "description": "",
* "type": "PM",
* "last_read_id": 9150005005,
* "last_message_id": 9150005005
* }
* ],
* "channel": {
* "channel_id": 1234,
* "description": "",
* "icon": "https://a.ppy.sh/102?1500537068"
* "message_length_limit": 450,
* "moderated": false,
* "name": "peppy",
* "type": "PM",
* "uuid": null,
* "last_message_id": 9150005005,
* "users": [
* 101,
* 102
* ]
* },
* "message": {
* "message_id": 9150005005,
* "sender_id": 102,
* "channel_id": 1234,
* "timestamp": "2018-07-06T06:33:42+00:00",
* "content": "i can haz featured artist plz?",
* "is_action": false,
* "message_id": 9150005005,
* "sender_id": 102,
* "timestamp": "2024-12-23T01:23:45+00:00",
* "type": "plain",
* "uuid": "some-uuid-string",
* "sender": {
* "id": 102,
* "username": "nekodex",
* "profile_colour": "#333333",
* "avatar_url": "https://a.ppy.sh/102?1500537068",
* "country_code": "AU",
* "default_group": "default",
* "id": 102,
* "is_active": true,
* "is_bot": false,
* "is_deleted": false,
* "is_online": true,
* "is_supporter": true
* "last_visit": "2024-12-23T01:23:45+00:00",
* "pm_friends_only": false,
* "profile_colour": "#333333",
* "username": "nekodex",
* }
* },
* "new_channel_id": 1234,
Expand Down
4 changes: 1 addition & 3 deletions app/Jobs/Notifications/BeatmapOwnerChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class BeatmapOwnerChange extends BroadcastNotificationBase

protected $beatmap;
protected $beatmapset;
protected $user;

public static function getMailLink(Notification $notification): string
{
Expand All @@ -32,7 +31,6 @@ public function __construct(Beatmap $beatmap, User $source)

$this->beatmap = $beatmap;
$this->beatmapset = $beatmap->beatmapset;
$this->user = $beatmap->user;
}

public function getDetails(): array
Expand All @@ -48,7 +46,7 @@ public function getDetails(): array

public function getListeningUserIds(): array
{
return [$this->user->getKey()];
return $this->beatmap->beatmapOwners()->pluck('user_id')->all();
}

public function getNotifiable()
Expand Down
11 changes: 11 additions & 0 deletions app/Models/Multiplayer/Room.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Room extends Model
const PLAYLIST_QUEUE_MODE = 'host_only';
const REALTIME_DEFAULT_QUEUE_MODE = 'host_only';
const REALTIME_QUEUE_MODES = [ 'host_only', 'all_players', 'all_players_round_robin' ];
const REALTIME_STATUSES = ['idle', 'playing'];

public ?array $preloadedRecentParticipants = null;

Expand Down Expand Up @@ -149,6 +150,7 @@ public static function search(array $rawParams, ?int $maxLimit = null)
'mode',
'season_id:int',
'sort',
'status',
'type_group',
'user:any',
], ['null_missing' => true]);
Expand All @@ -157,6 +159,7 @@ public static function search(array $rawParams, ?int $maxLimit = null)
$user = $params['user'];
$seasonId = $params['season_id'];
$sort = $params['sort'];
$status = $params['status'];
$category = $params['category'];
$typeGroup = $params['type_group'];

Expand All @@ -173,6 +176,14 @@ public static function search(array $rawParams, ?int $maxLimit = null)

$query = static::whereIn('type', static::TYPE_GROUPS[$typeGroup]);

if (!in_array($status, static::REALTIME_STATUSES, true)) {
$status = null;
}

if (isset($status)) {
$query->where('status', $status);
}

if (isset($seasonId)) {
$query->whereRelation('seasons', 'seasons.id', $seasonId);
}
Expand Down
5 changes: 0 additions & 5 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,6 @@ function max_offset($page, $limit)
return max(0, min($offset, $GLOBALS['cfg']['osu']['pagination']['max_count'] - $limit));
}

function mysql_escape_like($string)
{
return addcslashes($string, '%_\\');
}

function oauth_token(): ?App\Models\OAuth\Token
{
return Request::instance()->attributes->get(App\Http\Middleware\AuthApi::REQUEST_OAUTH_TOKEN_KEY);
Expand Down

0 comments on commit 703442b

Please sign in to comment.