Skip to content

Commit

Permalink
#2611 Preparation for route publishing options in Teams
Browse files Browse the repository at this point in the history
  • Loading branch information
Wotuu committed Nov 13, 2024
1 parent ca2e7cb commit f467878
Show file tree
Hide file tree
Showing 9 changed files with 335 additions and 239 deletions.
10 changes: 5 additions & 5 deletions app/Models/Team.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @property string $invite_code
* @property string $default_role
*
* @property Collection<TeamUser> $teamusers
* @property Collection<TeamUser> $teamUsers
* @property Collection<User> $members
* @property Collection<DungeonRoute> $dungeonroutes
*
Expand All @@ -47,7 +47,7 @@ public function getRouteKeyName(): string
return 'public_key';
}

public function teamusers(): HasMany
public function teamUsers(): HasMany
{
return $this->hasMany(TeamUser::class);
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public function removeRoute(DungeonRoute $dungeonRoute): bool
public function getUserRole(User $user): ?string
{
/** @var TeamUser $teamUser */
$teamUser = $this->teamusers()->where('user_id', $user->id)->first();
$teamUser = $this->teamUsers()->where('user_id', $user->id)->first();

return $teamUser?->role;
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public function canChangeRole(User $user, User $targetUser, string $role): bool
public function changeRole(User $user, string $role): void
{
/** @var TeamUser $teamUser */
$teamUser = $this->teamusers()->where('user_id', $user->id)->first();
$teamUser = $this->teamUsers()->where('user_id', $user->id)->first();
$roles = TeamUser::ALL_ROLES;
// Only when user is part of the team, and when the role is a valid one.
if ($teamUser !== null && isset($roles[$role])) {
Expand Down Expand Up @@ -381,7 +381,7 @@ public function getNewAdminUponAdminAccountDeletion(User $user): ?User

$roles = TeamUser::ALL_ROLES;
/** @var TeamUser|null $newOwner */
$newOwner = $this->teamusers->where('user_id', '!=', $user->id)
$newOwner = $this->teamUsers->where('user_id', '!=', $user->id)
->sortByDesc(static fn($obj, $key) => $roles[$obj->role])
->first();

Expand Down
69 changes: 41 additions & 28 deletions lang/en_US/view_team.php
Original file line number Diff line number Diff line change
@@ -1,37 +1,50 @@
<?php

return [
'edit' => [
'title' => 'Team %s',
'overview' => 'Overview',
'routes' => 'Routes',
'members' => 'Members',
'team_tags' => 'Team tags',
'team_details' => 'Team details',
'edittabs' => [
'details' => [
'title' => 'Team details',
],
'members' => [
'title' => 'Members',

'menu_title' => 'Teams',
'to_team_list' => 'Team list',
'team_header' => 'Team %s',
'icon_image_alt' => 'No image',
'route_list' => 'Route list',
'add_route' => 'Add route',
'add_route_no_moderator' => 'You must be a Moderator of this team to add routes',
'stop_adding_routes' => 'Stop adding routes',
'invite_new_members' => 'Invite new members',
'invite_code_share_warning' => 'Be careful who you share the invite link with, everyone with the link can join your team!',
'copy_to_clipboard_title' => 'Copy to clipboard',
'refresh_invite_link_title' => 'Refresh invite link',

'invite_new_members' => 'Invite new members',
'invite_code_share_warning' => 'Be careful who you share the invite link with, everyone with the link can join your team!',
'copy_to_clipboard_title' => 'Copy to clipboard',
'refresh_invite_link_title' => 'Refresh invite link',
'default_role' => 'Default role',

'ad_free_giveaway_description_not_available' => 'Subscribing to :patreon allows you to give away up to :max ad-free experiences to Keystone.guru to any team member.',
'ad_free_giveaway_description_available' => 'Thank you for subscribing to Keystone.guru\'s :patreon! You can give away :current more ad-free experiences to Keystone.guru to any team member.',

'default_role' => 'Default role',

'team_tags_description' => 'You can manage tags for the team\'s routes here. Everyone that is a member of this team may view the tags attached to the routes.
'ad_free_giveaway_description_not_available' => 'Subscribing to :patreon allows you to give away up to :max ad-free experiences to Keystone.guru to any team member.',
'ad_free_giveaway_description_available' => 'Thank you for subscribing to Keystone.guru\'s :patreon! You can give away :current more ad-free experiences to Keystone.guru to any team member.',
],
'overview' => [
'title' => 'Overview',
],
'routepublishing' => [
'title' => 'Route publishing',
],
'routes' => [
'title' => 'Route list',
'add_route' => 'Add route',
'add_route_no_moderator' => 'You must be a Moderator of this team to add routes',
'stop_adding_routes' => 'Stop adding routes',
],
'tags' => [
'title' => 'Tags',
'description' => 'You can manage tags for the team\'s routes here. Everyone that is a member of this team may view the tags attached to the routes.
The personal tags that may or may not have been attached by the route owner will not be visible.',
],

],
'edit' => [
'title' => 'Team %s',
'menu_title' => 'Teams',
'to_team_list' => 'Team list',
'team_header' => 'Team %s',
'icon_image_alt' => 'No image',
],
'invite' => [
'invite' => [
'linkpreview_title' => 'Invitation to join team %s',
'linkpreview_description' => 'You have been invited to join team %s. Login or register on Keystone.guru to join the team, it\'s free!',

Expand All @@ -53,15 +66,15 @@
'invite_not_found' => 'This team could not be found. Perhaps the invite link has been changed or the team has been deleted.',
'back_to_homepage' => 'Back to the home page',
],
'list' => [
'list' => [
'title' => 'My teams',
'header' => 'My teams',
'create_team' => 'Create team',
'table_header_team' => 'Team',
'table_header_members' => 'Members',
'table_header_routes' => 'Routes',
],
'new' => [
'new' => [
'title' => 'New team',
'header' => 'New team',
],
Expand Down
Loading

0 comments on commit f467878

Please sign in to comment.