Skip to content

fix(discord): hide empty Service URL and N/A Ping fields#6561

Merged
CommanderStorm merged 4 commits intolouislam:masterfrom
DanielDerefaka:fix/discord-empty-service-url
Jan 2, 2026
Merged

fix(discord): hide empty Service URL and N/A Ping fields#6561
CommanderStorm merged 4 commits intolouislam:masterfrom
DanielDerefaka:fix/discord-empty-service-url

Conversation

@DanielDerefaka
Copy link
Copy Markdown
Contributor

Summary

  • Only show Service URL field when extractAddress returns a non-empty value
  • Only show Ping field when ping value is not null

This fixes the issue where Discord notifications display unnecessary information:

  • Service URL: https:// for groups (which have no actual URL)
  • Ping: N/A when ping value is not available

Changes

Modified server/notification-providers/discord.js to conditionally include these fields only when they have meaningful values.

Test plan

  • Verified the conditional logic works with empty extractAddress returns
  • Verified Ping field is hidden when null

Fixes #3327

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=101010297

- Only show Service URL field when extractAddress returns a non-empty value
- Only show Ping field when ping value is not null
- This fixes unnecessary 'https://' and 'N/A' values showing for groups

Fixes louislam#3327

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=101010297
Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can we move the call to extractAddress outside to only do it once?

Also, could you include the screenshots for this notification provider that it still works?

@CommanderStorm CommanderStorm marked this pull request as draft January 1, 2026 14:46
@CommanderStorm CommanderStorm added the pr:please address review comments this PR needs a bit more work to be mergable label Jan 1, 2026
Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, lets merge 🎉

I changed a the logic a bit, now there is only one extractAddress

@CommanderStorm CommanderStorm marked this pull request as ready for review January 2, 2026 05:48
Copilot AI review requested due to automatic review settings January 2, 2026 05:48
@CommanderStorm CommanderStorm removed the pr:please address review comments this PR needs a bit more work to be mergable label Jan 2, 2026
@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Jan 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Discord notifications by conditionally hiding fields that contain no meaningful information. The changes prevent displaying empty Service URLs (like "https://" for monitor groups) and "N/A" Ping values when ping data is unavailable.

Key Changes:

  • Extract address value once into a variable for reuse
  • Add conditional check to only show Service URL field when address has a value
  • Add conditional check to only show Ping field when ping is not null

}

// If heartbeatJSON is not null, we go into the normal alerting loop.
let addess = this.extractAddress(monitorJSON);
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name "addess" is misspelled. It should be "address" (missing 'r').

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +64
...((!notification.disableUrl && addess) ? [{
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
value: this.extractAddress(monitorJSON),
value: addess,
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name "addess" is misspelled. It should be "address" (missing 'r'). This affects all references throughout the function.

Copilot uses AI. Check for mistakes.
Comment on lines +102 to +104
...((!notification.disableUrl && addess) ? [{
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
value: this.extractAddress(monitorJSON),
value: addess,
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name "addess" is misspelled. It should be "address" (missing 'r'). This affects all references throughout the function.

Copilot uses AI. Check for mistakes.
@CommanderStorm CommanderStorm merged commit 91f0f87 into louislam:master Jan 2, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discord] Service URL should only be included if defined

3 participants