-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Properly migrate automatic merge GitLab comments #27873
Conversation
Maybe add a test? |
@@ -488,30 +489,8 @@ func (g *GitlabDownloader) GetComments(commentable base.Commentable) ([]*base.Co | |||
return nil, false, fmt.Errorf("error while listing comments: %v %w", g.repoID, err) | |||
} | |||
for _, comment := range comments { | |||
// Flatten comment threads | |||
if !comment.IndividualNote { |
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.
This line now will be ignored?
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.
Both branches here were exactly the same, except only the first note was converted if IndividualNote
is true. That isn't really necessary, because IndividualNote
means that this is not a discussion (=thread) but just a single comment that cannot be responded to. There will always be exactly one note in such a "discussion", so there is no reason to explicitly ignore any further notes.
@lunny @silverwind Is there anything else you would like me to change? |
I will review it again. |
@lunny Any chance you could look at this again? I have a lot more changes coming to make GitLab imports better. |
@silverwind Could you please take another look as well? |
Sorry for back and forth, I noticed the CSS |
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* giteaofficial/main: Start to migrate from `util.OptionalBool` to `optional.Option[bool]` (go-gitea#29329) Add slow SQL query warning (go-gitea#27545) Unify organizations header (go-gitea#29248) Frontport changelogs of minor releases (go-gitea#29337) Support SAML authentication (go-gitea#25165) Upgrade to fabric 6 (go-gitea#29334) Don't show third-party JS errors in production builds (go-gitea#29303) Remove bountysource (go-gitea#29330) Remove unnecessary "Str2html" modifier from templates (go-gitea#29319) Ignore the linux anchor point to avoid linux migrate failure (go-gitea#29295) Remove jQuery from the repo commit functions (go-gitea#29230) Remove unnecessary "Safe" modifier from templates (go-gitea#29318) Remove jQuery from the image pasting functionality (go-gitea#29324) Improve the `issue_comment` workflow trigger event (go-gitea#29277) Properly migrate automatic merge GitLab comments (go-gitea#27873) Refactor cmd setup and remove deadcode (go-gitea#29313) small cache when get user id on interation (go-gitea#29296) Discard unread data of `git cat-file` (go-gitea#29297) Don't install playwright twice (go-gitea#29302) # Conflicts: # templates/home.tmpl
GitLab generates "system notes" whenever an event happens within the platform. Unlike Gitea, those events are stored and retrieved as text comments with no semantic details. The only way to tell whether a comment was generated in this manner is the
system
flag on the note type.This PR adds detection for two specific kinds of events: Scheduling and un-scheduling of automatic merges on a PR. When detected, they are downloaded using Gitea's type for these events, and eventually uploaded into Gitea in the expected format, i.e. with no text content in the comment.
This PR also updates the template used to render comments to add support for migrated comments of these two types.
ref: https://gitlab.com/gitlab-org/gitlab/-/blob/11bd6dc826e0bea2832324a1d7356949a9398884/app/services/system_notes/merge_requests_service.rb#L6-L17