Skip to content

Commit

Permalink
Add DryRun in comment creation
Browse files Browse the repository at this point in the history
  • Loading branch information
miko committed Jan 24, 2025
1 parent c2193ed commit 917d8e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions commentapi/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type CreateArgs struct {
SigningTS string `json:"signing_ts"`
MentionedChannels []MentionedChannel `json:"mentioned_channels"`
IsProtected bool `json:"is_protected"`
DryRun bool `json:"dry_run"`
}

// CreateResponse response for the comment.Create rpc call
Expand Down
5 changes: 5 additions & 0 deletions server/services/v1/comments/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ func create(_ *http.Request, args *commentapi.CreateArgs, reply *commentapi.Crea
return err
}

if args.DryRun {
reply.CommentItem = &item
return nil
}

err = request.comment.Insert(db.RW, boil.Infer())
if err != nil {
return err
Expand Down

0 comments on commit 917d8e4

Please sign in to comment.