Skip to content

Commit

Permalink
fix: missing username
Browse files Browse the repository at this point in the history
  • Loading branch information
coltenkrauter committed Sep 25, 2024
1 parent cdeef1d commit 5b9508d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ jobs:
github-token: ${{ secrets.GH_TOKEN_GH_NOTIFIER }}
channels: C07L8EWB389
slack-token: ${{ secrets.SLACK_TOKEN_GH_NOTIFIER }}
with-test-data: true
- name: Print Output
run: echo "${{ steps.test-action.outputs.response }}"
5 changes: 3 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41955,7 +41955,8 @@ async function getPullBlocks(pull, slack, withUserMentions) {
email,
username,
});
const displayName = slackUser?.profile?.display_name;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const displayName = slackUser?.profile?.display_name || slackUser?.profile?.real_name_normalized || username;
const imageUrl = slackUser?.profile?.image_72;
contextBlocks.push({
elements: [
Expand All @@ -41969,7 +41970,7 @@ async function getPullBlocks(pull, slack, withUserMentions) {
type: 'image',
},
{
text: `*${displayName ?? username}* ${context} _${relativeHumanReadableAge}_.`,
text: `*${displayName}* ${context} _${relativeHumanReadableAge}_.`,
type: 'mrkdwn',
},
],
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/utils/slack/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export async function getPullBlocks(pull: Pull, slack: SlackClient, withUserMent
username,
})

const displayName = slackUser?.profile?.display_name
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const displayName = slackUser?.profile?.display_name || slackUser?.profile?.real_name_normalized || username
const imageUrl = slackUser?.profile?.image_72

contextBlocks.push({
Expand All @@ -160,7 +161,7 @@ export async function getPullBlocks(pull: Pull, slack: SlackClient, withUserMent
type: 'image',
},
{
text: `*${displayName ?? username}* ${context} _${relativeHumanReadableAge}_.`,
text: `*${displayName}* ${context} _${relativeHumanReadableAge}_.`,
type: 'mrkdwn',
},
],
Expand Down

0 comments on commit 5b9508d

Please sign in to comment.