Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
fix: Fixes Slack notification formatting (#49)
Browse files Browse the repository at this point in the history
* fix: Fixes Slack notification formatting

* feat: Adds safeguard on name formatting
  • Loading branch information
frgfm authored Dec 21, 2023
1 parent 16e3e46 commit ca20609
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/api/api_v1/endpoints/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ async def _create_user(payload: UserCreate, users: UserCRUD, requester: Union[Us
slack_client.notify(
"*New user* :partying_face:",
[
("Name", gh_user["name"]),
("Email", gh_user["email"]),
("Company", f"`{gh_user['company']}`"),
("Name", gh_user["name"] or "N/A"),
("Email", gh_user["email"] or "N/A"),
("Company", f"`{gh_user['company']}`" if gh_user["company"] else "N/A"),
("GitHub", f"<{gh_user['html_url']}|{gh_user['login']}> ({gh_user['followers']} followers)"),
("Twitter", f"<https://twitter.com/{gh_user['twitter_username']}|{gh_user['twitter_username']}>"),
(
"Twitter",
f"<https://twitter.com/{gh_user['twitter_username']}|{gh_user['twitter_username']}>"
if gh_user["twitter_username"]
else "N/A",
),
],
)
return user
Expand Down

0 comments on commit ca20609

Please sign in to comment.