Add Vote Rewards feature with 7daystodie-servers.com provider#46
Merged
Conversation
Players who vote for the server at listing sites earn an in-game reward. v1 ships the backend end-to-end with a single provider: - 7daystodie-servers.com adapter behind a pluggable IVoteSiteProvider interface (gtop100, top-7daystodieservers slot in next as one class each) - Background sweep timer polls each enabled provider on its configured cadence (default 5 min) and grants any unclaimed votes - /vote chat command for on-demand claims (off-game-thread, replies via pm once the network round-trip completes) - vote_grants audit/idempotency table — unique on (provider, steam_id, vote_date) so racing sweeps and /vote commands can't double-grant - REST endpoints under /api/voterewards for settings + audit log (frontend Settings tab is a follow-up) v1 reward type: Points (uses existing PointsRepository.AdjustPoints). VipGift and CdKey throw NotImplementedException with a clear message — template-clone wiring is the next iteration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
AdaInTheLab
added a commit
that referenced
this pull request
Apr 30, 2026
UI surface for the VoteRewardsFeature backend that landed in #46: - New "Vote Rewards" tab in SettingsView (admin-only, value="9") - Master enable toggle + per-provider config block (enabled, API key, server ID, poll interval, reward type, points amount, broadcast template) - Recent grants audit table at the bottom (datetime, provider, player, steam id, reward type+value) - VipGift and CdKey reward types are present as Select options but their associated input fields are disabled with a "(not yet implemented)" hint so admins know choosing them won't grant — backend throws NotImplementedException for these until the v1.5 dispatch lands Wired up: - frontend/src/api/voterewards.ts — REST client - VoteRewardsSettings, VoteProviderSettings, VoteGrant types - ChatCommandSettings extended with voteEnabled / voteCooldownSeconds to match the C# settings POCO - en.ts has the canonical strings; ja/ko/zh-CN/zh-TW carry English placeholders with a "translations TBD" comment so vue-tsc's structural check passes — native translations are a follow-up Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8 tasks
AdaInTheLab
added a commit
that referenced
this pull request
Apr 30, 2026
Bug introduced (in spirit) by #46 and made very visible by #48: when DispatchReward throws AFTER the audit/idempotency row was inserted, the player is permanently locked out of ever claiming that vote. Future sweeps see HasGrantForDate=true and short-circuit before retrying, even though no reward was ever actually granted. This always could have happened (e.g. SQLite glitch on AdjustPoints), but #48's VipGift dispatch made it likely — a misspelled template name in the Vote Rewards settings would silently lock out every voter on that provider. Fix: narrow try/catch around the DispatchReward call. On exception, delete the audit row via the new IVoteGrantRepository.DeleteByKey so the next sweep can retry once the admin fixes the misconfiguration. The outer try/catch (network errors during GetClaimStatus / MarkClaimed) is unaffected — those failure modes don't leave an orphaned row, so they don't need rollback. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Players who vote for the server at listing sites (7daystodie-servers.com, gtop100, etc.) earn an in-game reward. This PR ships the full backend with one provider — adding more is now a one-class change.
v1 reward type
Only Points dispatch is wired (uses existing `PointsRepository.AdjustPoints`). `VipGift` and `CdKey` throw `NotImplementedException` with a clear message — the template-clone wiring for VIP-gift rewards is the natural next iteration. Defaulting providers to disabled means upgrades won't accidentally start granting points before an admin has reviewed the config.
Files
DI is convention-based — `*Repository` types and `IFeature` types register automatically, so no `ServiceRegistry` edits.
Test plan
🤖 Generated with Claude Code