Skip to content

Add inline commit coments #35240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

coder1125
Copy link

Adds inline comments to commits. Inline commit comments can be considered new feature and does not use the existing
functionality of comments, issues or attachments.

/claim #4898

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 8, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/frontend labels Aug 8, 2025
@wxiaoguang
Copy link
Contributor

A quick look, still many problems:

  • Some functions have security problems (for example: DeleteCommitAttachment can delete any attachment by UUID)
  • Some designs are strange (for example: there is no ctx.Session.Get("attachmentsMaps") in existing code base, it looks not right)
  • Too many if-else logic (in go and tmpl code) for "different pages", it is quite fragile
  • Incorrect tmpl variables (for example: ctx: ctx.Data can't be right)
  • Incorrect logic (for example: CancelCommitComment)
  • Many functions have complex logic, so they need tests.

So overall it doesn't look good enough. If it can continue, please review the changed code line by line and add necessary tests. (by the way: I only take a quick look for the code, I haven't really thought about whether the design is feasible).

@wxiaoguang wxiaoguang marked this pull request as draft August 8, 2025 17:36
@coder1125 coder1125 force-pushed the AddInlineCommitComments branch from 5e92a99 to 9025105 Compare August 9, 2025 08:03
* Resolve Incorrect logic in CancelCommitComment func
* Rename CommitData to CommitComment
* Added ReplyToCommentID column in CommitComment
@coder1125
Copy link
Author

From the list, the following are resolved

  • Incorrect tmpl variables (for example: ctx: ctx.Data can't be right) The line was added for testing and has been removed.
  • Incorrect logic (for example: CancelCommitComment) Corrected logic by throwing ServerError if error exists.
  • Rename CommitData to CommitComment
  • Added ReplyToCommentID column. When replying to message, the commentid of the original message is stored in ReplyToCommentID.

Line int64
FileName string
CommitSHA string `xorm:"VARCHAR(64)"`
Attachments string `xorm:"JSON TEXT"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the design how to cooperate with attachment table? The attachment maybe GC because all foreign indexes are zero?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design is based on the proposed solution, the commitcomment table is not dependent on attachment table. Further details about handling of foreign indexes need to be provided and/or discussed.

* Set copyright year to 2025
* Rename CreateCommitDataOptions to CreateCommitCommentOptions
* Rename FindCommitDataOptions to FindCommitCommentOptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 Bounty claim lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants