mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
fix: add workspace owner id as query param to websocket (#18363)
Co-authored-by: Steven Masley <stevenmasley@gmail.com>
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/coder/coder/v2/codersdk/wsjson"
|
||||
"github.com/coder/websocket"
|
||||
@ -125,8 +126,17 @@ type DynamicParametersResponse struct {
|
||||
// TODO: Workspace tags
|
||||
}
|
||||
|
||||
func (c *Client) TemplateVersionDynamicParameters(ctx context.Context, version uuid.UUID) (*wsjson.Stream[DynamicParametersResponse, DynamicParametersRequest], error) {
|
||||
conn, err := c.Dial(ctx, fmt.Sprintf("/api/v2/templateversions/%s/dynamic-parameters", version), nil)
|
||||
func (c *Client) TemplateVersionDynamicParameters(ctx context.Context, userID string, version uuid.UUID) (*wsjson.Stream[DynamicParametersResponse, DynamicParametersRequest], error) {
|
||||
endpoint := fmt.Sprintf("/api/v2/templateversions/%s/dynamic-parameters", version)
|
||||
if userID != Me {
|
||||
uid, err := uuid.Parse(userID)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("invalid user ID: %w", err)
|
||||
}
|
||||
endpoint += fmt.Sprintf("?user_id=%s", uid.String())
|
||||
}
|
||||
|
||||
conn, err := c.Dial(ctx, endpoint, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user