@@ -80,13 +80,13 @@ func (s *DoltStore) GetAllEventsSince(ctx context.Context, sinceID int64) ([]*ty
8080}
8181
8282// AddIssueComment adds a comment to an issue (structured comment)
83- func (s * DoltStore ) AddIssueComment (ctx context.Context , issueID , author , text string ) (* types.Comment , error ) {
84- return s .ImportIssueComment (ctx , issueID , author , text , time .Now ().UTC ())
83+ func (s * DoltStore ) AddIssueComment (ctx context.Context , issueID , author , text , commentType string ) (* types.Comment , error ) {
84+ return s .ImportIssueComment (ctx , issueID , author , text , commentType , time .Now ().UTC ())
8585}
8686
8787// ImportIssueComment adds a comment during import, preserving the original timestamp.
8888// This prevents comment timestamp drift across import/export cycles.
89- func (s * DoltStore ) ImportIssueComment (ctx context.Context , issueID , author , text string , createdAt time.Time ) (* types.Comment , error ) {
89+ func (s * DoltStore ) ImportIssueComment (ctx context.Context , issueID , author , text , commentType string , createdAt time.Time ) (* types.Comment , error ) {
9090 // Verify issue exists — route to wisps table for active wisps
9191 issueTable := "issues"
9292 commentTable := "comments"
@@ -110,9 +110,9 @@ func (s *DoltStore) ImportIssueComment(ctx context.Context, issueID, author, tex
110110 createdAt = createdAt .UTC ()
111111 //nolint:gosec // G201: table is hardcoded
112112 result , err := s .execContext (ctx , fmt .Sprintf (`
113- INSERT INTO %s (issue_id, author, text, created_at)
114- VALUES (?, ?, ?, ?)
115- ` , commentTable ), issueID , author , text , createdAt )
113+ INSERT INTO %s (issue_id, author, text, type, created_at)
114+ VALUES (?, ?, ?, ?, ? )
115+ ` , commentTable ), issueID , author , text , commentType , createdAt )
116116 if err != nil {
117117 return nil , fmt .Errorf ("failed to add comment: %w" , err )
118118 }
@@ -127,6 +127,7 @@ func (s *DoltStore) ImportIssueComment(ctx context.Context, issueID, author, tex
127127 IssueID : issueID ,
128128 Author : author ,
129129 Text : text ,
130+ Type : commentType ,
130131 CreatedAt : createdAt ,
131132 }, nil
132133}
@@ -140,7 +141,7 @@ func (s *DoltStore) GetIssueComments(ctx context.Context, issueID string) ([]*ty
140141
141142 //nolint:gosec // G201: table is hardcoded
142143 rows , err := s .queryContext (ctx , fmt .Sprintf (`
143- SELECT id, issue_id, author, text, created_at
144+ SELECT id, issue_id, author, text, type, created_at
144145 FROM %s
145146 WHERE issue_id = ?
146147 ORDER BY created_at ASC
@@ -153,6 +154,28 @@ func (s *DoltStore) GetIssueComments(ctx context.Context, issueID string) ([]*ty
153154 return scanComments (rows )
154155}
155156
157+ // GetIssueCommentsByType retrieves comments for an issue filtered by type.
158+ func (s * DoltStore ) GetIssueCommentsByType (ctx context.Context , issueID , commentType string ) ([]* types.Comment , error ) {
159+ table := "comments"
160+ if s .isActiveWisp (ctx , issueID ) {
161+ table = "wisp_comments"
162+ }
163+
164+ //nolint:gosec // G201: table is hardcoded
165+ rows , err := s .queryContext (ctx , fmt .Sprintf (`
166+ SELECT id, issue_id, author, text, type, created_at
167+ FROM %s
168+ WHERE issue_id = ? AND type = ?
169+ ORDER BY created_at ASC
170+ ` , table ), issueID , commentType )
171+ if err != nil {
172+ return nil , fmt .Errorf ("failed to get comments by type: %w" , err )
173+ }
174+ defer rows .Close ()
175+
176+ return scanComments (rows )
177+ }
178+
156179// GetCommentsForIssues retrieves comments for multiple issues
157180func (s * DoltStore ) GetCommentsForIssues (ctx context.Context , issueIDs []string ) (map [string ][]* types.Comment , error ) {
158181 if len (issueIDs ) == 0 {
@@ -192,7 +215,7 @@ func (s *DoltStore) getCommentsForIDsInto(ctx context.Context, table string, ids
192215
193216 //nolint:gosec // G201: table is hardcoded, placeholders contains only ? markers
194217 query := fmt .Sprintf (`
195- SELECT id, issue_id, author, text, created_at
218+ SELECT id, issue_id, author, text, type, created_at
196219 FROM %s
197220 WHERE issue_id IN (%s)
198221 ORDER BY issue_id, created_at ASC
@@ -205,7 +228,7 @@ func (s *DoltStore) getCommentsForIDsInto(ctx context.Context, table string, ids
205228
206229 for rows .Next () {
207230 var c types.Comment
208- if err := rows .Scan (& c .ID , & c .IssueID , & c .Author , & c .Text , & c .CreatedAt ); err != nil {
231+ if err := rows .Scan (& c .ID , & c .IssueID , & c .Author , & c .Text , & c .Type , & c . CreatedAt ); err != nil {
209232 _ = rows .Close ()
210233 return fmt .Errorf ("failed to scan comment: %w" , err )
211234 }
@@ -317,7 +340,7 @@ func scanComments(rows *sql.Rows) ([]*types.Comment, error) {
317340 var comments []* types.Comment
318341 for rows .Next () {
319342 var c types.Comment
320- if err := rows .Scan (& c .ID , & c .IssueID , & c .Author , & c .Text , & c .CreatedAt ); err != nil {
343+ if err := rows .Scan (& c .ID , & c .IssueID , & c .Author , & c .Text , & c .Type , & c . CreatedAt ); err != nil {
321344 return nil , fmt .Errorf ("failed to scan comment: %w" , err )
322345 }
323346 comments = append (comments , & c )
0 commit comments