From 183967861f4a68dbcd182ae9325aa800d256a323 Mon Sep 17 00:00:00 2001 From: nanaya Date: Tue, 17 Dec 2024 21:36:32 +0900 Subject: [PATCH 1/4] Adjust team description input area Add toolbar and lock the height. --- resources/css/bem/input-text.less | 12 ++++++++++++ .../css/bem/team-settings-description-preview.less | 2 +- resources/views/teams/edit.blade.php | 11 +++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/resources/css/bem/input-text.less b/resources/css/bem/input-text.less index 26555c9fd3d..c809fe8db09 100644 --- a/resources/css/bem/input-text.less +++ b/resources/css/bem/input-text.less @@ -10,4 +10,16 @@ padding: var(--input-padding); box-shadow: inset 0 0 0 2px var(--input-border-colour); border-radius: @border-radius-large; + + &--bbcode { + .fancy-scrollbar(); + display: grid; + grid-template-rows: 1fr auto; + gap: 5px; + } + + &__bbcode-textarea { + .reset-input(); + resize: none; + } } diff --git a/resources/css/bem/team-settings-description-preview.less b/resources/css/bem/team-settings-description-preview.less index f1c0b8481b2..2e78b7b8d33 100644 --- a/resources/css/bem/team-settings-description-preview.less +++ b/resources/css/bem/team-settings-description-preview.less @@ -4,5 +4,5 @@ .team-settings-description-preview { padding: 0 var(--padding); overflow-y: scroll; - max-height: calc(70 * var(--vh)); + height: calc(70 * var(--vh)); } diff --git a/resources/views/teams/edit.blade.php b/resources/views/teams/edit.blade.php index 7dd5a31fdec..91c57089f74 100644 --- a/resources/views/teams/edit.blade.php +++ b/resources/views/teams/edit.blade.php @@ -149,10 +149,13 @@ class="team-settings__image" {{ osu_trans('teams.edit.description.label') }} - +
+ + @include('forum._post_toolbar') +
From 7c2da5ac549edabac5a8c611d601c1fb76441cba Mon Sep 17 00:00:00 2001 From: nanaya Date: Tue, 17 Dec 2024 22:47:54 +0900 Subject: [PATCH 2/4] Trim username in all cases on login --- app/Models/User.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 737b66a56e6..dcee75bbedc 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2128,8 +2128,10 @@ public static function attemptLogin($user, $password, $ip = null) public static function findForLogin($username, $allowEmail = false) { - if (!present($username)) { - return; + $username = trim($username ?? ''); + + if ($username === null) { + return null; } $query = static::where('username', $username); From 65e1fe9b59ea9b8851a1db79fce308c4821613b5 Mon Sep 17 00:00:00 2001 From: nanaya Date: Wed, 18 Dec 2024 17:50:02 +0900 Subject: [PATCH 3/4] Fix handling of deleted and restricted members --- app/Models/TeamMember.php | 9 +++++++++ resources/views/teams/members/index.blade.php | 13 ++++++++----- resources/views/teams/show.blade.php | 5 ++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/Models/TeamMember.php b/app/Models/TeamMember.php index d2510426fa1..84030ee2257 100644 --- a/app/Models/TeamMember.php +++ b/app/Models/TeamMember.php @@ -24,4 +24,13 @@ public function user(): BelongsTo { return $this->belongsTo(User::class, 'user_id'); } + + public function userOrDeleted(): User + { + $user = $this->user; + + return $user === null || $user->isRestricted() + ? new DeletedUser(['user_id' => $this->user_id]) + : $user; + } } diff --git a/resources/views/teams/members/index.blade.php b/resources/views/teams/members/index.blade.php index b470ff76f9d..cc549d03c58 100644 --- a/resources/views/teams/members/index.blade.php +++ b/resources/views/teams/members/index.blade.php @@ -24,23 +24,26 @@ {{ osu_trans('teams.members.index.table.joined_at') }} @foreach ($team->members as $member) + @php + $user = $member->userOrDeleted(); + @endphp
  • user->user_avatar) !!} + {!! background_image($user->user_avatar) !!} > - {!! link_to_user($member->user, null, '', []) !!} + {!! link_to_user($user, null, '', []) !!} - {{ osu_trans('teams.members.index.status.status_'.(int) $member->user->isActive()) }} - @if ($member->user->isOnline()) + {{ osu_trans('teams.members.index.status.status_'.(int) $user->isActive()) }} + @if ($user->isOnline()) ({!! osu_trans('users.show.lastvisit_online') !!}) - @elseif (($lastvisit = $member->user->displayed_last_visit) !== null) + @elseif (($lastvisit = $user->displayed_last_visit) !== null) ({!! osu_trans('users.show.lastvisit', ['date' => timeago($lastvisit)]) !!}) diff --git a/resources/views/teams/show.blade.php b/resources/views/teams/show.blade.php index ba1153f329c..45b1d84f37d 100644 --- a/resources/views/teams/show.blade.php +++ b/resources/views/teams/show.blade.php @@ -3,16 +3,15 @@ See the LICENCE file in the repository root for full licence text. --}} @php - use App\Models\DeletedUser; use App\Transformers\UserCompactTransformer; $userTransformer = new UserCompactTransformer(); $toJson = fn ($users) => json_collection($users, $userTransformer, UserCompactTransformer::CARD_INCLUDES); $teamMembers = array_map($toJson, $team->members->mapToGroups(fn ($member) => [ - $member->user_id === $team->leader_id ? 'leader' : 'member' => $member->user, + $member->user_id === $team->leader_id ? 'leader' : 'member' => $member->userOrDeleted(), ])->all()); $teamMembers['member'] ??= []; - $teamMembers['leader'] ??= $toJson([$team->leader ?? new DeletedUser(['user_id' => $team->leader_id])]); + $teamMembers['leader'] ??= $toJson([$team->members()->make(['user_id' => $team->leader_id])->userOrDeleted()]); $headerUrl = $team->header()->url(); @endphp From b70e5ccd8a71547eb6d90f6802cc385c9e9dba1e Mon Sep 17 00:00:00 2001 From: nanaya Date: Wed, 18 Dec 2024 19:59:01 +0900 Subject: [PATCH 4/4] Remove redundant container --- resources/views/teams/show.blade.php | 180 +++++++++++++-------------- 1 file changed, 89 insertions(+), 91 deletions(-) diff --git a/resources/views/teams/show.blade.php b/resources/views/teams/show.blade.php index 45b1d84f37d..7e8bd0e786c 100644 --- a/resources/views/teams/show.blade.php +++ b/resources/views/teams/show.blade.php @@ -25,114 +25,112 @@ 'backgroundImage' => $headerUrl, ]]) -
    -
    -
    -
    - @if (priv_check('TeamUpdate', $team)->can()) -
    - - - +
    +
    +
    + @if (priv_check('TeamUpdate', $team)->can()) + - @endif -
    -
    -
    - @include('objects._flag_team', ['modifiers' => 'full', 'team' => $team]) + + +
    -
    -

    - {{ $team->name }} -

    -
    -

    - [{{ $team->short_name }}] -

    -
    + @endif +
    +
    +
    + @include('objects._flag_team', ['modifiers' => 'full', 'team' => $team]) +
    +
    +

    + {{ $team->name }} +

    +
    +

    + [{{ $team->short_name }}] +

    -