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

Add support multiple projects again #30381

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

tyroneyeh
Copy link
Contributor

due to renaming branch name reopen the PR

Closes #12974 and #27984 #30163

Can anyone help with testing and review?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 10, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 10, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/js labels Apr 10, 2024
@@ -123,25 +117,51 @@ func addUpdateIssueProject(ctx context.Context, issue *Issue, doer *user_model.U
}
}

if _, err := db.GetEngine(ctx).Where("project_issue.issue_id=?", issue.ID).Delete(&project_model.ProjectIssue{}); err != nil {
return err
if action == "null" {
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to create different methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you give an example?

Copy link
Member

Choose a reason for hiding this comment

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

I mean using mutiple methods instead of one method but a parameter action for different logic.

@lunny lunny added this to the 1.23.0 milestone Apr 11, 2024
@@ -154,7 +154,7 @@
{{if .IsProjectsEnabled}}
<div class="divider"></div>

<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-project dropdown">
<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-projects dropdown">
Copy link
Member

Choose a reason for hiding this comment

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

$ rg select-project
templates/repo/issue/view_content/sidebar.tmpl:157:		<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-project dropdown">
templates/repo/issue/view_content/sidebar.tmpl:196:		<div class="ui select-project list">
templates/repo/issue/new_form.tmpl:86:		<div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating jump select-project dropdown">
templates/repo/issue/new_form.tmpl:131:		<div class="ui select-project list">
web_src/js/features/repo-legacy.js:309:  selectItem('.select-project', '#project_id');

You forgot at least the JS rename.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only one project can be selected in a new issue, and multiple projects can be selected after adding a new issue. So the js here cannot use multi-project method

{{if eq .IssueID $ProjectID}}
{{$checked = true}}
{{break}}
{{end}}
Copy link
Member

Choose a reason for hiding this comment

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

Surely there must be better ways than such a loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, but I don't know how to implement it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Seems ok then. In JS i would just do arr.find but of course golang or it's templates are not much into functional programming 😆.

@lunny lunny mentioned this pull request May 7, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code modifies/js modifies/templates This PR modifies the template files size/L Denotes a PR that changes 100-499 lines, ignoring generated files. topic/projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow multiple projects per issue
5 participants