Skip to content

Add discord user search#13

Draft
LouiseMcMahon wants to merge 24 commits intomainfrom
add-discord-user-search
Draft

Add discord user search#13
LouiseMcMahon wants to merge 24 commits intomainfrom
add-discord-user-search

Conversation

@LouiseMcMahon
Copy link
Copy Markdown
Contributor

@LouiseMcMahon LouiseMcMahon commented Feb 6, 2025

Description

  • Adds a route to add the discord bot to the discord server
  • Adds the ability to assign a discord user to a member
  • Displays attached discord member info on member view screen

How has this been tested?

Manually and via unit tests

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2025

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

  • app/Console/Commands/PutDiscordMembersCommand.php (100%)
  • app/DiscordData/GuildMemberData.php (100%)
  • app/Http/Controllers/Admin/DiscordAdminController.php (100%)
  • app/Http/Controllers/API/DiscordUserSearchAPIController.php (100%)
  • app/Http/Controllers/Members/MemberEditController.php (100%)
  • app/Http/Controllers/Members/MemberShowController.php (100%)
  • app/Http/Controllers/Members/MemberUpdateController.php (100%)
  • app/Http/Middleware/PermissionMiddleware.php (90.0%): Missing lines 24
  • app/Http/Requests/DiscordUsers/DiscordUserSearchRequest.php (100%)
  • app/Http/Requests/Members/MembersUpdateRequest.php (100%)
  • app/Jobs/PutDiscordMembersJob.php (100%)
  • app/Models/DiscordUser.php (0.0%): Missing lines 73-74
  • app/Models/Member.php (0.0%): Missing lines 114
  • app/Policies/MemberPolicy.php (0.0%): Missing lines 55
  • app/Services/Discord/DiscordService.php (100%)

Summary

  • Total: 118 lines
  • Missing: 5 lines
  • Coverage: 95%

app/Http/Middleware/PermissionMiddleware.php

  20             throw UnauthorizedException::notLoggedIn();
  21         }
  22 
  23         $permissions = is_array($permission)
! 24             ? $permission
  25             : explode('|', $permission);
  26 
  27         if (! $user->checkPermissions($permissions)) {
  28             throw UnauthorizedException::forPermissions($permissions);

app/Models/DiscordUser.php

  69     }
  70 
  71     public function getAvatar(): string
  72     {
! 73         if (config('services.discord.fake_avatars')) {
! 74             return 'https://cdn.discordapp.com/embed/avatars/0.png';
  75         }
  76 
  77         return sprintf('https://cdn.discordapp.com/avatars/%s/%s.png', $this->discord_id, $this->avatar_hash);
  78     }

app/Models/Member.php

  110     }
  111 
  112     public function user(): BelongsTo
  113     {
! 114         return $this->belongsTo(User::class);
  115     }
  116 
  117     public function emailAddresses(): HasMany
  118     {

app/Policies/MemberPolicy.php

  51     }
  52 
  53     public function changeDiscordMember(User $user, Member $member): bool
  54     {
! 55         return $user->checkPermissions(PermissionEnum::EDITDISCORDUSERS);
  56     }
  57 
  58     /**
  59      * Determine whether the user can delete the model.

@LouiseMcMahon LouiseMcMahon force-pushed the add-discord-user-search branch from e20ec08 to 7ba8c75 Compare February 6, 2025 17:28
@LouiseMcMahon LouiseMcMahon force-pushed the add-discord-user-search branch from e7dc9b0 to 5784516 Compare February 6, 2025 17:31
@LouiseMcMahon LouiseMcMahon marked this pull request as draft February 20, 2025 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant