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:
@@ -39,6 +39,7 @@ func (s *Service) CancelEvent(ctx context.Context, actor domain.Account, eventID
|
||||
_ = s.Store.AppendAudit(ctx, actor.ID, "event.cancelled", eventID, event)
|
||||
s.Bus.Publish("event:"+eventID, event)
|
||||
s.Bus.Publish("events", event)
|
||||
s.enqueueDiscordRoleSync(ctx, eventID, DiscordRoleActionTeardown)
|
||||
}
|
||||
return event, err
|
||||
}
|
||||
@@ -321,6 +322,9 @@ func (s *Service) SubstituteRoster(ctx context.Context, actor domain.Account, ev
|
||||
}
|
||||
_ = s.Store.AppendAudit(ctx, actor.ID, action, eventID, map[string]string{"outgoingPlayerId": outgoingID, "incomingPlayerId": reserveID})
|
||||
s.Bus.Publish("event:"+eventID, roster)
|
||||
if emergency {
|
||||
s.enqueueDiscordRoleSync(ctx, eventID, DiscordRoleActionReconcile)
|
||||
}
|
||||
}
|
||||
return roster, err
|
||||
}
|
||||
@@ -389,6 +393,7 @@ func (s *Service) ConfirmRosters(ctx context.Context, actor domain.Account, even
|
||||
if err == nil {
|
||||
_ = s.Store.AppendAudit(ctx, actor.ID, "roster.confirmed", eventID, roster)
|
||||
s.Bus.Publish("event:"+eventID, event)
|
||||
s.enqueueDiscordRoleSync(ctx, eventID, DiscordRoleActionReconcile)
|
||||
}
|
||||
return event, err
|
||||
}
|
||||
@@ -571,6 +576,9 @@ func (s *Service) RevertWorkflowStage(ctx context.Context, actor domain.Account,
|
||||
if err == nil {
|
||||
_ = s.Store.AppendAudit(ctx, actor.ID, "workflow.reverted", eventID, map[string]domain.EventState{"state": previous})
|
||||
s.Bus.Publish("event:"+eventID, event)
|
||||
if previous == domain.RostersDraft {
|
||||
s.enqueueDiscordRoleSync(ctx, eventID, DiscordRoleActionTeardown)
|
||||
}
|
||||
}
|
||||
return event, err
|
||||
}
|
||||
@@ -684,6 +692,9 @@ func (s *Service) RecordSeriesResult(ctx context.Context, actor domain.Account,
|
||||
old := event.Version
|
||||
event.State, event.Version, event.UpdatedAt = domain.Completed, event.Version+1, s.Now()
|
||||
_, getErr = s.Store.SaveEventWorkflow(ctx, event, old)
|
||||
if getErr == nil {
|
||||
s.enqueueDiscordRoleSync(ctx, out.EventID, DiscordRoleActionTeardown)
|
||||
}
|
||||
}
|
||||
return out, getErr
|
||||
}
|
||||
@@ -736,6 +747,9 @@ func (s *Service) RecordSeriesResult(ctx context.Context, actor domain.Account,
|
||||
old := event.Version
|
||||
event.State, event.Version, event.UpdatedAt = domain.Completed, event.Version+1, s.Now()
|
||||
_, getErr = s.Store.SaveEventWorkflow(ctx, event, old)
|
||||
if getErr == nil {
|
||||
s.enqueueDiscordRoleSync(ctx, out.EventID, DiscordRoleActionTeardown)
|
||||
}
|
||||
}
|
||||
err = getErr
|
||||
}
|
||||
@@ -799,6 +813,9 @@ func (s *Service) advanceGraphTournament(ctx context.Context, completed domain.S
|
||||
old := event.Version
|
||||
event.State, event.Version, event.UpdatedAt = domain.Completed, event.Version+1, s.Now()
|
||||
_, err = s.Store.SaveEventWorkflow(ctx, event, old)
|
||||
if err == nil {
|
||||
s.enqueueDiscordRoleSync(ctx, completed.EventID, DiscordRoleActionTeardown)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user