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
base: main
Are you sure you want to change the base?
Conversation
@@ -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" { |
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.
I think it's better to create different methods.
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.
Can you give an example?
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.
I mean using mutiple methods instead of one method but a parameter action
for different logic.
@@ -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"> |
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.
$ 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.
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.
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}} |
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.
Surely there must be better ways than such a loop?
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.
Maybe, but I don't know how to implement it?
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.
https://github.com/go-gitea/gitea/blob/main/templates/repo/issue/view_content/sidebar.tmpl#L229C7-L232C12
The assigned fields also use the loop method
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.
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 😆.
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
due to renaming branch name reopen the PR
Closes #12974 and #27984 #30163
Can anyone help with testing and review?