Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
UNRELEASED CHANGES:

*
* Fix avatar being invalid in the Contact API call

v1.6.2 - 2018-01-25
-------------------
Expand Down
4 changes: 2 additions & 2 deletions app/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ public function getCompletedTasks()
* @param int $size
* @return string
*/
public function getAvatarURL($size = 100)
public function getAvatarURL($size = 110)
{
// it either returns null or the gravatar url if it's defined
if (! $this->has_avatar) {
Expand All @@ -816,7 +816,7 @@ public function getAvatarURL($size = 100)
$avatar_extension = pathinfo($original_avatar_url, PATHINFO_EXTENSION);
$resized_avatar = 'avatars/'.$avatar_filename.'_'.$size.'.'.$avatar_extension;

return Storage::disk($this->avatar_location)->url($resized_avatar);
return asset(Storage::disk($this->avatar_location)->url($resized_avatar));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Resources/Contact/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function toArray($request)
'company' => $this->company,
]),
'avatar' => $this->when(! $this->is_partial, [
'url' => $this->getAvatarUrl(),
'url' => $this->getAvatarUrl(110),
'source' => $this->getAvatarSource(),
]),
'food_preferencies' => $this->when(! $this->is_partial, $this->food_preferencies),
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public function testGetAvatarReturnsPath()
$contact->avatar_file_name = 'h0FMvD2cA3r2Q1EtGiv7aq9yl5BoXH2KIenDsoGX.jpg';

$this->assertEquals(
'/storage/avatars/h0FMvD2cA3r2Q1EtGiv7aq9yl5BoXH2KIenDsoGX_100.jpg',
asset('/storage/avatars/h0FMvD2cA3r2Q1EtGiv7aq9yl5BoXH2KIenDsoGX_100.jpg'),
$contact->getAvatarURL(100)
);
}
Expand Down