Skip to content

Commit

Permalink
Merge pull request #304 from StadGent/feature/HEAT-6767463
Browse files Browse the repository at this point in the history
HEAT-6767463: Fix users not all visible and not receiving invitation mail when registration
  • Loading branch information
jonasanne authored Nov 13, 2024
2 parents 14c63a4 + 0e4582f commit 9fb632d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [2.7.5]

### Fixed
- only 50 users visible on users overview
- user not receiving invitation mail when adding to platform
- link inside the register confirmation mail did not work.

## [2.7.4]

### Fixed
Expand Down Expand Up @@ -220,6 +227,7 @@
- Remove cancel button


[2.7.5]: https://github.com/StadGent/laravel_site_opening-hours/compare/2.7.4...2.7.5
[2.7.4]: https://github.com/StadGent/laravel_site_opening-hours/compare/2.7.3...2.7.4
[2.7.3]: https://github.com/StadGent/laravel_site_opening-hours/compare/2.7.2...2.7.3
[2.7.2]: https://github.com/StadGent/laravel_site_opening-hours/compare/2.7.1...2.7.2
Expand Down
10 changes: 8 additions & 2 deletions app/Repositories/EloquentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ public function __construct($model)
$this->model = $model;
}

public function getAll($limit = 50, $offset = 0)
public function getAll($limit = null, $offset = null)
{
return $this->model->take($limit)->skip($offset)->get()->toArray();
$query = $this->model->take($limit);

if (!is_null($offset)) {
$query->skip($offset);
}

return $query->get()->toArray();
}

public function store(array $properties)
Expand Down
10 changes: 8 additions & 2 deletions app/Repositories/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@ public function getById($userId)
*
* @return array
*/
public function getAll($limit = 50, $offset = 0)
public function getAll($limit = null, $offset = null)
{
$users = $this->model->take($limit)->skip($offset)->get();
$query = $this->model->take($limit);

if (!is_null($offset)) {
$query->skip($offset);
}

$users = $query->get();

$results = [];

Expand Down
18 changes: 9 additions & 9 deletions app/Services/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,21 @@ public function createNewUser($email)
*/
public function setRolesToUser($email, Role $role, Collection $services = null)
{
$user = User::where('email', $email)->firstOrCreate(['email' => $email]);
$user = User::where('email', $email)->first();

$newUser = $user->wasRecentlyCreated;
if (is_null($user)) {
$user = $this->createNewUser($email);
}

$this->attachRoleToUser($user, $role);

foreach ($services as $service) {
$this->linkUserToService($user, $service, $role, $newUser);
}

if (!$newUser) {
// Send mail with overview of added services.
Mail::to($user)->send(new SendInviteConfirmation($user, $services));
$this->linkUserToService($user, $service, $role);
}


// Send mail with overview of added services.
Mail::to($user)->send(new SendInviteConfirmation($user, $services));

$user->role = $role->name;

return $user;
Expand Down

0 comments on commit 9fb632d

Please sign in to comment.