kwartzlab / kos-base

KwartzlabOS
4 stars 1 forks source link

fix(new-member-application): use preferred first name and last name if available #25

Closed azend closed 7 months ago

azend commented 7 months ago

This PR fixes a display bug most commonly found in new member application emails where the applying member's display name is presented.

In certain situations where either a preferred first or last name are optionally provided, the application expects both preferred first name and last name to be present. This creates a display error where only the applicant's preferred first name is rendered as the full name unless the applicant's preferred last name is also available.

Changes in this PR check and use both preferred first name and last name if available independently but otherwise default to legal first name and last name.

azend commented 7 months ago

We should write a test case for this model function before merge but I don't have enough familiarity with Laravel at the moment to competently make that adjustment. Collabs welcome.

azend commented 7 months ago
$ ./vendor/bin/phpunit
PHPUnit 9.6.9 by Sebastian Bergmann and contributors.

................................................................. 65 / 79 ( 82%)
..............                                                    79 / 79 (100%)

Time: 00:07.709, Memory: 64.50 MB

OK (79 tests, 166 assertions)
azend commented 7 months ago

Updated to use the null coalescing operator as @IanEdington suggested. Looks much cleaner!

% docker-compose exec app ./vendor/bin/phpunit
PHPUnit 9.6.9 by Sebastian Bergmann and contributors.

................................................................. 65 / 79 ( 82%)
..............                                                    79 / 79 (100%)

Time: 00:07.862, Memory: 64.50 MB

OK (79 tests, 166 assertions)