mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 11:35:03 +01:00 
			
		
		
		
	Add comment replies (#5104)
* Add comment replies * Replace reviewID with review.ID
This commit is contained in:
		
							parent
							
								
									9458880c06
								
							
						
					
					
						commit
						f38fce916e
					
				| @ -377,6 +377,7 @@ type CodeCommentForm struct { | ||||
| 	Line     int64 | ||||
| 	TreePath string `form:"path" binding:"Required"` | ||||
| 	IsReview bool   `form:"is_review"` | ||||
| 	Reply    int64  `form:"reply"` | ||||
| } | ||||
| 
 | ||||
| // Validate validates the fields | ||||
|  | ||||
| @ -63,6 +63,9 @@ func CreateCodeComment(ctx *context.Context, form auth.CodeCommentForm) { | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	if review.ID == 0 { | ||||
| 		review.ID = form.Reply | ||||
| 	} | ||||
| 	//FIXME check if line, commit and treepath exist | ||||
| 	comment, err := models.CreateCodeComment( | ||||
| 		ctx.User, | ||||
| @ -78,7 +81,7 @@ func CreateCodeComment(ctx *context.Context, form auth.CodeCommentForm) { | ||||
| 		return | ||||
| 	} | ||||
| 	// Send no notification if comment is pending | ||||
| 	if !form.IsReview { | ||||
| 	if !form.IsReview || form.Reply != 0 { | ||||
| 		notification.NotifyCreateIssueComment(ctx.User, issue.Repo, issue, comment) | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -151,7 +151,7 @@ | ||||
| 																			{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} | ||||
| 																			</ui> | ||||
| 																		</div> | ||||
| 																	{{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $ "comment" (index $line.Comments 0)}} | ||||
| 																	{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}} | ||||
| 																	</div> | ||||
| 																{{end}} | ||||
| 															</td> | ||||
| @ -164,7 +164,7 @@ | ||||
| 																			{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} | ||||
| 																			</ui> | ||||
| 																		</div> | ||||
| 																		{{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $ "comment" (index $line.Comments 0)}} | ||||
| 																		{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}} | ||||
| 																	</div> | ||||
| 																{{end}} | ||||
| 															</td> | ||||
|  | ||||
| @ -25,19 +25,19 @@ | ||||
| 		<div class="footer"> | ||||
| 			<span class="markdown-info"><i class="octicon octicon-markdown"></i> {{$.root.i18n.Tr "repo.diff.comment.markdown_info"}}</span> | ||||
| 			<div class="ui right floated"> | ||||
| 				{{if not $.reply}} | ||||
| 				{{if $.reply}} | ||||
| 					<button name="reply" value="{{$.reply}}" class="ui submit green tiny button btn-reply">{{$.root.i18n.Tr "repo.diff.comment.reply"}}</button> | ||||
| 				{{else}} | ||||
| 					{{if $.root.CurrentReview}} | ||||
| 						<button name="is_review" value="true" type="submit" | ||||
| 								class="ui submit green tiny button btn-add-comment">{{$.root.i18n.Tr "repo.diff.comment.add_review_comment"}}</button> | ||||
| 					{{else}} | ||||
| 						<button name="is_review" value="true"  type="submit" | ||||
| 								class="ui submit green tiny button btn-start-review">{{$.root.i18n.Tr "repo.diff.comment.start_review"}}</button> | ||||
| 						<button type="submit" | ||||
| 								class="ui submit tiny basic button btn-add-single">{{$.root.i18n.Tr "repo.diff.comment.add_single_comment"}}</button> | ||||
| 					{{end}} | ||||
| 				{{end}} | ||||
| 				{{if not $.root.CurrentReview}} | ||||
| 				<button type="submit" | ||||
| 					class="ui submit tiny basic button btn-add-single">{{$.root.i18n.Tr "repo.diff.comment.add_single_comment"}}</button> | ||||
| 				{{end}} | ||||
| 				{{if or (not $.HasComments) $.hidden}} | ||||
| 					<button type="button" class="ui submit tiny basic button btn-cancel" onclick="cancelCodeComment(this);">{{$.root.i18n.Tr "cancel"}}</button> | ||||
| 				{{end}} | ||||
|  | ||||
| @ -32,7 +32,7 @@ | ||||
| 						{{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}} | ||||
| 						</ui> | ||||
| 					</div> | ||||
| 					{{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $.root "comment" (index $line.Comments 0)}} | ||||
| 					{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $line.Comments 0).ReviewID "root" $.root "comment" (index $line.Comments 0)}} | ||||
| 				</div> | ||||
| 			</td> | ||||
| 		</tr> | ||||
|  | ||||
| @ -342,7 +342,7 @@ | ||||
| 										</div> | ||||
| 									{{end}} | ||||
| 								</div> | ||||
| 								{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" true "root" $ "comment" (index $comms 0)}} | ||||
| 								{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $comms 0).ReviewID "root" $ "comment" (index $comms 0)}} | ||||
| 							</div> | ||||
| 						</div> | ||||
| 				{{end}} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user