Skip to content

🚧 feat: Add empty contract list handling in boost admin#1928

Merged
mkmccarty merged 1 commit intomainfrom
mm-branch-3
Dec 11, 2025
Merged

🚧 feat: Add empty contract list handling in boost admin#1928
mkmccarty merged 1 commit intomainfrom
mm-branch-3

Conversation

@mkmccarty
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 11, 2025 06:20
@mkmccarty mkmccarty merged commit 4497064 into main Dec 11, 2025
12 checks passed
@mkmccarty mkmccarty deleted the mm-branch-3 branch December 11, 2025 06:20
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 adds handling for the scenario where the contract list is empty after filtering in the boost admin functionality. However, the implementation contains logic issues that prevent it from functioning correctly.

  • Adds a check for empty contract fields before returning the final embed
  • Attempts to handle the case where no contracts are available to display

Comment thread src/boost/boost_admin.go
Comment on lines +282 to +293
if len(Contracts) == 0 {
embed := &discordgo.MessageSend{
Embeds: []*discordgo.MessageEmbed{{
Type: discordgo.EmbedTypeRich,
Title: "Contract List",
Description: "No contracts available",
Color: getRandomColor(),
Fields: field,
}},
}
return "", embed, nil
}
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

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

The nested condition checking len(Contracts) == 0 is unreachable because this function already returns early (lines 212-224) when there are no contracts. If execution reaches line 281, len(Contracts) is guaranteed to be greater than 0.

The real issue to handle here is when len(field) == 0 due to guild filtering (all contracts were filtered out by the guildID check at lines 261-264). In that case, the embed should indicate "No contracts for this guild" rather than "No contracts available".

Suggested change
if len(Contracts) == 0 {
embed := &discordgo.MessageSend{
Embeds: []*discordgo.MessageEmbed{{
Type: discordgo.EmbedTypeRich,
Title: "Contract List",
Description: "No contracts available",
Color: getRandomColor(),
Fields: field,
}},
}
return "", embed, nil
}
embed := &discordgo.MessageSend{
Embeds: []*discordgo.MessageEmbed{{
Type: discordgo.EmbedTypeRich,
Title: "Contract List",
Description: "No contracts for this guild",
Color: getRandomColor(),
Fields: field,
}},
}
return "", embed, nil

Copilot uses AI. Check for mistakes.
Comment thread src/boost/boost_admin.go
Title: "Contract List",
Description: "No contracts available",
Color: getRandomColor(),
Fields: field,
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

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

Setting Fields: field when field is guaranteed to be empty (since we're inside a len(field) == 0 check) is unnecessary. You can omit this field assignment or explicitly set it to nil.

Suggested change
Fields: field,

Copilot uses AI. Check for mistakes.
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.

2 participants