Skip to content

Commit a58bca0

Browse files
Merge pull request #1445 from liberu-genealogy/copilot/fix-remaining-tests-logic
Fix 10 test errors and 2 test failures across multiple models and services
2 parents c9d21a8 + a91639e commit a58bca0

File tree

8 files changed

+46
-1
lines changed

8 files changed

+46
-1
lines changed

app/Actions/Jetstream/InviteTeamMember.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Support\Facades\Gate;
1010
use Illuminate\Support\Facades\Mail;
1111
use Illuminate\Support\Facades\Validator;
12+
use Illuminate\Support\Str;
1213
use Illuminate\Validation\Rule;
1314
use Laravel\Jetstream\Contracts\InvitesTeamMembers;
1415
use Laravel\Jetstream\Events\InvitingTeamMember;
@@ -32,6 +33,7 @@ public function invite(User $user, Team $team, string $email, ?string $role = nu
3233
$invitation = $team->teamInvitations()->create([
3334
'email' => $email,
3435
'role' => $role,
36+
'token' => Str::random(64),
3537
]);
3638

3739
Mail::to($email)->send(new TeamInvitation($invitation));

app/Http/Livewire/FanChartComponent.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ public function getColumnSpan(): int|string|array
1414
return 'full';
1515
}
1616

17+
public function getColumnStart(): int|string|array|null
18+
{
19+
return null;
20+
}
21+
1722
public function render()
1823
{
1924
$this->people = Person::all();

app/Models/DnaMatching.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class DnaMatching extends Model
1313
use BelongsToTenant;
1414

1515
protected $fillable = [
16+
'user_id',
1617
'file1',
1718
'file2',
1819
'image',

app/Models/Person.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ public function familiesAsWife()
9696
return $this->hasMany(Family::class, 'wife_id');
9797
}
9898

99+
public function families(): \Illuminate\Support\Collection
100+
{
101+
return $this->familiesAsHusband->merge($this->familiesAsWife);
102+
}
103+
99104
public function parents()
100105
{
101106
if (!$this->childInFamily) {

app/Models/PersonPhoto.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class PersonPhoto extends Model
2727
'analyzed_at',
2828
];
2929

30+
protected $attributes = [
31+
'is_analyzed' => false,
32+
];
33+
3034
protected $casts = [
3135
'is_analyzed' => 'boolean',
3236
'analyzed_at' => 'datetime',

app/Models/TeamInvitation.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class TeamInvitation extends JetstreamTeamInvitation
1717
protected $fillable = [
1818
'email',
1919
'role',
20+
'token',
2021
];
2122

2223
/**

app/Models/User.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@ protected function casts(): array
102102
];
103103
}
104104

105+
/**
106+
* Delete the user's profile photo.
107+
*/
108+
public function deleteProfilePhoto(): void
109+
{
110+
if (!is_null($this->profile_photo_path)) {
111+
\Illuminate\Support\Facades\Storage::disk($this->profilePhotoDisk())->delete($this->profile_photo_path);
112+
$this->forceFill(['profile_photo_path' => null])->save();
113+
}
114+
}
115+
116+
/**
117+
* Get the disk used for storing profile photos.
118+
*/
119+
protected function profilePhotoDisk(): string
120+
{
121+
return env('VAPOR_ARTIFACT_NAME') ? 's3' : config('jetstream.profile_photo_disk', 'public');
122+
}
123+
105124
/**
106125
* Get the URL to the user's profile photo.
107126
*/
@@ -435,6 +454,14 @@ public function socialConnectionPrivacy(): HasOne
435454
return $this->hasOne(SocialConnectionPrivacy::class);
436455
}
437456

457+
/**
458+
* Get the user's connected accounts.
459+
*/
460+
public function connectedAccounts(): HasMany
461+
{
462+
return $this->hasMany(ConnectedAccount::class);
463+
}
464+
438465
/**
439466
* Get the user's social family connections.
440467
*/

app/Services/SocialMediaConnectionService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function needsSync(ConnectedAccount $account): bool
139139
}
140140

141141
// Sync if older than 24 hours
142-
return now()->diffInHours($account->last_synced_at) > 24;
142+
return $account->last_synced_at->diffInHours(now()) >= 24;
143143
}
144144

145145
/**

0 commit comments

Comments
 (0)