Skip to content
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

Fix poster is not loaded in get default merge message #27657

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

lunny
Copy link
Member

@lunny lunny commented Oct 17, 2023

No description provided.

@lunny lunny added type/bug backport/v1.20 This PR should be backported to Gitea 1.20 backport/v1.21 This PR should be backported to Gitea 1.21 labels Oct 17, 2023
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 17, 2023
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 17, 2023
Copy link
Member

@lng2020 lng2020 left a comment

Choose a reason for hiding this comment

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

Why not load attributes in pr.LoadIssue and then remove all such pr.Issue.Loadxxx?

@@ -356,10 +356,10 @@ func (pr *PullRequest) LoadIssue(ctx context.Context) (err error) {
        }
 
        pr.Issue, err = GetIssueByID(ctx, pr.IssueID)
-       if err == nil {
-               pr.Issue.PullRequest = pr
+       if err != nil {
+               return err
        }
-       return err
+       return pr.Issue.LoadAttributes(ctx)
 }

@lunny
Copy link
Member Author

lunny commented Oct 17, 2023

Why not load attributes in pr.LoadIssue and then remove all such pr.Issue.Loadxxx?

@@ -356,10 +356,10 @@ func (pr *PullRequest) LoadIssue(ctx context.Context) (err error) {
        }
 
        pr.Issue, err = GetIssueByID(ctx, pr.IssueID)
-       if err == nil {
-               pr.Issue.PullRequest = pr
+       if err != nil {
+               return err
        }
-       return err
+       return pr.Issue.LoadAttributes(ctx)
 }

You don't know whether they need to load all attributes. This will increase memory usage.

@lng2020
Copy link
Member

lng2020 commented Oct 17, 2023

Just a suggestion to make the code look cleaner. If memory usage is the concern, then this PR is LGTM.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 17, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 17, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Oct 17, 2023
@lunny lunny enabled auto-merge (squash) October 17, 2023 14:21
@lunny lunny merged commit eeb1e02 into go-gitea:main Oct 17, 2023
@GiteaBot GiteaBot added this to the 1.22.0 milestone Oct 17, 2023
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Oct 17, 2023
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Oct 17, 2023
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Oct 17, 2023
@lunny lunny deleted the lunny/fix_get_default_merge_message branch October 17, 2023 15:17
silverwind pushed a commit that referenced this pull request Oct 17, 2023
Backport #27657 by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
silverwind pushed a commit that referenced this pull request Oct 17, 2023
Backport #27657 by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@GiteaBot
Copy link
Collaborator

I was unable to create a backport for 1.20. @lunny, please send one manually. 🍵

go run ./contrib/backport 27657
...  // fix git conflicts if any
go run ./contrib/backport --continue

@GiteaBot GiteaBot added the backport/manual No power to the bots! Create your backport yourself! label Oct 18, 2023
@GiteaBot
Copy link
Collaborator

I was unable to create a backport for 1.21. @lunny, please send one manually. 🍵

go run ./contrib/backport 27657
...  // fix git conflicts if any
go run ./contrib/backport --continue

@lunny lunny added the backport/done All backports for this PR have been created label Oct 18, 2023
zjjhot added a commit to zjjhot/gitea that referenced this pull request Oct 18, 2023
* giteaofficial/main:
  Improve the list header in milestone page (go-gitea#27302)
  Fix poster is not loaded in get default merge message (go-gitea#27657)
  Hide archived labels by default from the suggestions when assigning labels for an issue (go-gitea#27451)
  actions/setup-go use go-version-file (go-gitea#27651)
  Update agit-support.en-us.md (go-gitea#27652)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jan 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created backport/manual No power to the bots! Create your backport yourself! backport/v1.20 This PR should be backported to Gitea 1.20 backport/v1.21 This PR should be backported to Gitea 1.21 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants