HookArgs: Use IdentifiedUser.getNameEmail to format account name
In most of the hooks, the account is being formatted as either:
Name Surname (email@example.com)
when the account has an email address, or:
when the account does not have an email address. If the account name
is empty the anonymous coward name is used.
Instead of implementing this logic in the hook, defer it to the
existing implementation in IdentifiedUser which properly formats
the name when there is an email address:
Name Surname <firstname.lastname@example.org>
and also handles the cases where the account does not have an email
address but instead has a username, or falls back to the account Id.
The names used in the ref-update and commit-received hooks were already
formatted like this, so this change makes the rest of the hooks
2 files changed