-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
base: main
Are you sure you want to change the base?
Add inline commit coments #35240
Conversation
A quick look, still many problems:
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). |
5e92a99
to
9025105
Compare
* Resolve Incorrect logic in CancelCommitComment func * Rename CommitData to CommitComment * Added ReplyToCommentID column in CommitComment
From the list, the following are resolved
|
models/git/commit.go
Outdated
Line int64 | ||
FileName string | ||
CommitSHA string `xorm:"VARCHAR(64)"` | ||
Attachments string `xorm:"JSON TEXT"` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 discussed.
* Set copyright year to 2025 * Rename CreateCommitDataOptions to CreateCommitCommentOptions * Rename FindCommitDataOptions to FindCommitCommentOptions
func UploadCommitAttachment(ctx context.Context, file io.Reader, commitComment *CommitComment, opts *AttachmentOptions) error { | ||
attachmentUUID := uuid.New().String() | ||
|
||
ctx, committer, err := db.TxContext(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use db.WithTx
} | ||
|
||
func DeleteCommentReaction(ctx context.Context, reaction string, userID int64, commitComment *CommitComment) error { | ||
ctx, committer, err := db.TxContext(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use db.WithTx
return nil | ||
} | ||
|
||
ctx, committer, err := db.TxContext(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use db.WithTx
|
||
// CreateCommitComment creates comment with context | ||
func CreateCommitComment(ctx context.Context, opts *CreateCommitCommentOptions) (_ *CommitComment, err error) { | ||
ctx, committer, err := db.TxContext(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use db.WithTx2
return nil | ||
} | ||
|
||
func SaveTemporaryAttachment(ctx context.Context, file io.Reader, opts *AttachmentOptions) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It better to move the logic to service layer.
And there is an edge case, if a commit was GC, the commit comments and related attachments, reactions need to be deleted as well. |
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