feat: add chat sharing API (#24968)

This commit is contained in:
Danielle Maywood
2026-05-20 10:46:35 +01:00
committed by GitHub
parent 70ab2b9940
commit 96e3c49670
22 changed files with 1583 additions and 3 deletions
+9
View File
@@ -976,6 +976,13 @@ func WorkspaceRoleActions(role codersdk.WorkspaceRole) []policy.Action {
return []policy.Action{}
}
func ChatRoleActions(role codersdk.ChatRole) []policy.Action {
if role == codersdk.ChatRoleRead {
return []policy.Action{policy.ActionRead}
}
return []policy.Action{}
}
func ConnectionLogConnectionTypeFromAgentProtoConnectionType(typ agentproto.Connection_Type) (database.ConnectionType, error) {
switch typ {
case agentproto.Connection_SSH:
@@ -1739,6 +1746,8 @@ func Chat(c database.Chat, diffStatus *database.ChatDiffStatus, files []database
ID: c.ID,
OrganizationID: c.OrganizationID,
OwnerID: c.OwnerID,
OwnerUsername: c.OwnerUsername,
OwnerName: c.OwnerName,
LastModelConfigID: c.LastModelConfigID,
Title: c.Title,
Status: codersdk.ChatStatus(c.Status),
+2
View File
@@ -930,6 +930,8 @@ func TestChat_AllFieldsPopulated(t *testing.T) {
input := database.Chat{
ID: uuid.New(),
OwnerID: uuid.New(),
OwnerUsername: "owner-username",
OwnerName: "Owner Name",
OrganizationID: uuid.New(),
WorkspaceID: uuid.NullUUID{UUID: uuid.New(), Valid: true},
BuildID: uuid.NullUUID{UUID: uuid.New(), Valid: true},