Add Discord guild ID configuration and enhance event announcement options
This commit introduces the `DISCORD_GUILD_ID` environment variable to the configuration files, allowing for better integration with Discord for role synchronization. The event announcement functionality has been updated to include an option for the `@everyone` mention, which can be toggled during event creation. The backend logic has been modified to handle this new option, and corresponding updates have been made to the frontend to allow users to control the mention behavior. Additionally, tests have been added to ensure the correct functionality of these features.
This commit is contained in:
@@ -259,9 +259,24 @@ func (r *RosterDraft) MoveToReserve(teamID, playerID string) error {
|
||||
}
|
||||
|
||||
func (r *RosterDraft) EmergencySubstitute(teamID, outgoingID, reserveID string, rating int) error {
|
||||
replaceCaptain := false
|
||||
for _, team := range r.Teams {
|
||||
if team.ID == teamID && team.CaptainPlayerID == outgoingID {
|
||||
replaceCaptain = true
|
||||
break
|
||||
}
|
||||
}
|
||||
confirmed := r.Confirmed
|
||||
r.Confirmed = false
|
||||
err := r.Substitute(teamID, outgoingID, reserveID, rating)
|
||||
r.Confirmed = confirmed
|
||||
if err == nil && replaceCaptain {
|
||||
for index := range r.Teams {
|
||||
if r.Teams[index].ID == teamID {
|
||||
r.Teams[index].CaptainPlayerID = reserveID
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -83,6 +83,22 @@ func TestRosterDragOperationsPreserveEmptyRoleSlots(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmergencySubstitutionTransfersCaptain(t *testing.T) {
|
||||
roster := testRoster()
|
||||
roster.Confirmed = true
|
||||
roster.Teams[0].CaptainPlayerID = "a-t"
|
||||
roster.Teams[1].CaptainPlayerID = "b-t"
|
||||
if err := roster.EmergencySubstitute("a", "a-t", "reserve", 31); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if roster.Teams[0].CaptainPlayerID != "reserve" {
|
||||
t.Fatalf("captain role was not transferred to emergency substitute: %q", roster.Teams[0].CaptainPlayerID)
|
||||
}
|
||||
if err := roster.Validate(true); err != nil {
|
||||
t.Fatalf("emergency substitution left an invalid confirmed roster: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSeriesFSMRunsCoinBansAndResult(t *testing.T) {
|
||||
rules := testRules()
|
||||
series, err := NewSeries("series", "event", "", [2]string{"a", "b"}, rules)
|
||||
|
||||
Reference in New Issue
Block a user