Skip to content

Commit

Permalink
fix: Removed github mention from api
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Aug 22, 2024
1 parent 86e92cc commit ba32abb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 25 deletions.
1 change: 0 additions & 1 deletion app/Http/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function toArray(Request $request): array
'timezone' => $this->resource->getAttribute('timezone'),
'language' => $this->resource->getAttribute('language'),
'is_admin' => $this->resource->isAdmin(),
'github_login_enabled' => $this->resource->canLoginWithGithub(),
'weekly_summary_enabled' => $this->resource->isOptedInForWeeklySummary(),
],
'backup_tasks' => [
Expand Down
9 changes: 0 additions & 9 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class User extends Authenticatable implements TwoFactorAuthenticatable
'email',
'password',
'timezone',
'github_id',
'preferred_backup_destination_id',
'language',
'gravatar_email',
Expand Down Expand Up @@ -170,14 +169,6 @@ public function backupTasklogCountToday(): int
})->whereDate('created_at', today()->timezone($this->timezone ?? 'UTC'))->count();
}

/**
* Check if the user can log in with GitHub.
*/
public function canLoginWithGithub(): bool
{
return $this->github_id !== null;
}

/**
* Determine if the user is opted in to receive weekly summaries.
*/
Expand Down
1 change: 0 additions & 1 deletion tests/Feature/Profile/Api/UserAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
'timezone',
'language',
'is_admin',
'github_login_enabled',
'weekly_summary_enabled',
],
'backup_tasks' => [
Expand Down
14 changes: 0 additions & 14 deletions tests/Unit/Models/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,6 @@
$this->assertEquals(0, $user->backupTaskLogCountToday());
});

test('returns true if can login with github', function (): void {

$user = User::factory()->create(['github_id' => 1]);

$this->assertTrue($user->canLoginWithGithub());
});

test('returns false if can not login with github', function (): void {

$user = User::factory()->create();

$this->assertFalse($user->canLoginWithGithub());
});

test('returns only the users that have opted in for backup task summaries', function (): void {
$userOne = User::factory()->receivesWeeklySummaries()->create();
$userTwo = User::factory()->doesNotReceiveWeeklySummaries()->create();
Expand Down

0 comments on commit ba32abb

Please sign in to comment.