feat: support tickets between accounts and platform admins
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m0s
ci / test (pull_request) Successful in 12m1s
ci / build (pull_request) Successful in 18m14s
ci / image (pull_request) Successful in 5m9s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m0s
ci / test (pull_request) Successful in 12m1s
ci / build (pull_request) Successful in 18m14s
ci / image (pull_request) Successful in 5m9s
Accounts open tickets under Support and admins answer them under Admin → Support tickets. - A ticket is open while it waits for the admins and answered while it waits for the account. Either side can close or reopen it, and a reply reopens it. - The admins are mailed about new tickets and replies, and the account about answers. - A ticket can name the active organization and point at a monitor, notification channel, alert group, status page or incident in it. Each must be something the account can read. - Next to the conversation, admins see the account at a glance: state, sign-in, organizations with their limits and usage, and open tickets. - Admins switch support off and limit how many tickets an account has open at once. - Suspended accounts and those yet to accept the terms reach support too; a suspended account opens one ticket. - Tickets are part of the account export and are deleted with the account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
9fc3c6b050
commit
f3d402705e
25 files changed
+5296
-451
No files matched your search
@@ -32,9 +32,24 @@ type accountExport struct {
|
||||
Identities []exportIdentity `json:"sso_identities"`
|
||||
Tokens []exportToken `json:"api_tokens"`
|
||||
Consents []exportConsent `json:"consents"`
|
||||
Support []exportTicket `json:"support_tickets"`
|
||||
Activity []exportActivity `json:"activity"`
|
||||
}
|
||||
|
||||
type exportTicket struct {
|
||||
Subject string `json:"subject"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Messages []exportTicketMessage `json:"messages"`
|
||||
}
|
||||
|
||||
// exportTicketMessage leaves out which admin answered: that is about them.
|
||||
type exportTicketMessage struct {
|
||||
Time time.Time `json:"time"`
|
||||
FromStaff bool `json:"from_staff"`
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
// exportConsent is an accepted version of the privacy policy or terms.
|
||||
type exportConsent struct {
|
||||
Kind string `json:"kind"`
|
||||
@@ -156,6 +171,22 @@ func (s *Server) buildAccountExport(ctx context.Context, userID uuid.UUID) (acco
|
||||
ExpiresAt: t.ExpiresAt, LastUsedAt: t.LastUsedAt, CreatedAt: t.CreatedAt,
|
||||
})
|
||||
}
|
||||
tickets, err := q.ListUserSupportTickets(ctx, userID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
x.Support = []exportTicket{}
|
||||
for _, t := range tickets {
|
||||
msgs, err := q.SupportMessages(ctx, t.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
et := exportTicket{Subject: t.Subject, Status: t.Status, CreatedAt: t.CreatedAt, Messages: []exportTicketMessage{}}
|
||||
for _, m := range msgs {
|
||||
et.Messages = append(et.Messages, exportTicketMessage{Time: m.CreatedAt, FromStaff: m.FromStaff, Body: m.Body})
|
||||
}
|
||||
x.Support = append(x.Support, et)
|
||||
}
|
||||
events, err := q.UserAuditEvents(ctx, &userID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user