Skip to content

Add a new section named development in issue view sidebar to interact with branch/pr - #31899

Open
lunny wants to merge 97 commits into
go-gitea:mainfrom
lunny:lunny/issue_dev
Open

lunny wants to merge 97 commits into
go-gitea:mainfrom
lunny:lunny/issue_dev

Conversation

@lunny

@lunny lunny commented Aug 21, 2024 •

Copy link
Copy Markdown
Member

Partially Resolve #20226

This PR add a new section on the sidebar of issue named Development. It supports creating one or multiple branches and pull requests from the sidebar.

  1. No related branch or PR
    image

  2. Create new branch from the issue

image
  1. Related branch created
image
  1. Prefill title and content when creating pull request from the issue development link
    图片

  2. Realted PR created
    image

  3. Related PR merged
    image

  4. Mayge fixed near the issue title
    image

  • Delete dev_link records from the database when deleting repos/issues
  • Delete dev_link records from the database when deleting pull requests/branch
  • Allow creating multiple branches/pull requests from UI
  • Bring issue information into the pull request when creating the pull request.
  • Adjust the toast z-index to 9999 so that it will display in front of the modal.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 21, 2024
@lunny
lunny marked this pull request as ready for review August 29, 2024 19:46
@lunny lunny added this to the 1.23.0 milestone Aug 29, 2024
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Aug 29, 2024
@lunny
lunny marked this pull request as ready for review November 1, 2025 06:24
@lunny

lunny commented Nov 26, 2025

Copy link
Copy Markdown
Member Author

I think this is ready to review again.

Comment thread services/pull/pull.go
}

// add dev links
if pr.Flow == issues_model.PullRequestFlowGithub {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why GitHub-only ? Agit PR can't be used to close an issue?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agit PR have no real head branch. So that branch, err := git_model.GetBranch(ctx, pr.HeadRepoID, pr.HeadBranch) will fail.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it really reasonable?

Here you are creating "IssueDevLinkTypePullRequest" dev-links.

You mean that AGit PR can't be used to link to an issue and close the related issue?

Comment thread services/repository/branch.go Outdated
Comment thread services/repository/branch.go Outdated
<a class="tw-mt-1 fluid ui show-modal" data-modal="#create_branch">{{ctx.Locale.Tr "repo.branch.new_branch"}}</a>
</div>
{{end}}
{{range .DevLinks}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please don't use the data from root template data.

Most side bar parts have been refactored to use their own "struct" types to make code stable.

@wxiaoguang

Copy link
Copy Markdown
Contributor

I think this is ready to review again.

I don't.

@bircni

bircni commented Mar 23, 2026

Copy link
Copy Markdown
Member

@lunny updates on that?

@lunny

lunny commented Mar 23, 2026

Copy link
Copy Markdown
Member Author

@lunny updates on that?

Updated.

@wxiaoguang wxiaoguang left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

https://github.com/go-gitea/gitea/pull/31899/files#r1881918670

Just tried to play with GitHub's development sidebar for a while. I can see there could be a lot of edge cases:

  1. create a new branch 123-my-issue, rename the branch to 123-my-issue-other, the link disappears, rename another branch to 123-my-issue, the link won't appear again.
  2. create a new branch 123-my-issue, create a PR from 123-my-issue, then the link is updated to PR, the branch link is replaced.

I believe these details need enough documents(comments) and tests.

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 23, 2026
@claesrosell

Copy link
Copy Markdown

I just downloaded this branch to play around with the development sidebar in its current state, to test the edge cases that wxiaoguang mentioned earlier.

The rename and delete branch scenarios behave very differently from the described GitHub behavior. This is not necessarily a bad thing, though:

  1. Create a new branch (123-my-issue) and rename it (123-my-issue-other): The link still works, pointing to the same branch with its new name. If you delete the branch, the link disappears. If a new branch with the same name is created, the link will not magically appear again. Personally I think this behavior is better then GitHub

  2. Create a new branch (123-my-issue) and create a PR from that branch: The PR shows up in the development sidebar, but the branch (with a "create PR" button) is still there. This branch should probably be hidden when a PR for it is visible in the sidebar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged topic/ui Change the appearance of the Gitea UI topic/ux How users interact with Gitea type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a branch from an issue, with pull/merge request

10 participants