Merge pull request 'fix: Small fixes and rename for #5482' (#5505) from timedin/forgejo:forgejo into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5505
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Otto 2024-10-09 20:13:51 +00:00
commit fd3bff3181
4 changed files with 8 additions and 10 deletions

View file

@ -317,7 +317,7 @@ type WebhookForm struct {
type CreateIssueForm struct {
Title string `binding:"Required;MaxSize(255)"`
LabelIDs string `form:"label_ids"`
AssigneeIDs string `form:"assignee_id"`
AssigneeIDs string `form:"assignee_ids"`
Ref string `form:"ref"`
MilestoneID int64
ProjectID int64

View file

@ -1,4 +1,4 @@
<input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
<input id="assignee_ids" name="assignee_ids" type="hidden" value="{{.assignee_ids}}">
<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-assignees{{if .isExistingIssue}}-modify{{end}} dropdown">
<a class="text muted flex-text-block">
<strong>{{ctx.Locale.Tr "repo.issues.new.assignees"}}</strong>
@ -6,7 +6,7 @@
{{svg "octicon-gear" 16 "tw-ml-1"}}
{{end}}
</a>
<div class="filter menu" {{if .isExistingIssue}} data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee" {{else}} data-id="#assignee_id" {{end}}>
<div class="filter menu" {{if .isExistingIssue}} data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee" {{else}} data-id="#assignee_ids" {{end}}>
<div class="ui icon search input">
<i class="icon">{{svg "octicon-search" 16}}</i>
<input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignees"}}">
@ -36,7 +36,7 @@
{{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}
{{with index .Assignees 0}}
<a class="item select-assign-me" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}" {{if $.isExistingIssue}} data-action="update" {{end}} data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee" role="option">
<a class="select-assign-me" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}" {{if $.isExistingIssue}} data-action="update" {{end}} data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee" role="option">
{{ctx.Locale.Tr "repo.issues.new.assign_to_me"}}
</a>
{{end}}

View file

@ -119,10 +119,10 @@ test('Issue: Assignees', async ({browser}, workerInfo) => {
// Clear all assignees
await page.locator('.select-assignees-modify.dropdown').click();
await page.locator('.select-assignees-modify.dropdown .no-select.item').click();
await page.waitForLoadState('networkidle');
await expect(assigneesList.filter({hasText: 'user2'})).toBeHidden();
await expect(assigneesList.filter({hasText: 'user4'})).toBeHidden();
await expect(page.locator('.ui.assignees.list .item.no-select')).toBeVisible();
await expect(page.locator('.select-assign-me')).toBeVisible();
// Assign other user (with searchbox)
await page.locator('.select-assignees-modify.dropdown').click();
@ -131,20 +131,17 @@ test('Issue: Assignees', async ({browser}, workerInfo) => {
await expect(page.locator('.select-assignees-modify .menu .item').filter({hasText: 'user4'})).toBeVisible();
await page.locator('.select-assignees-modify .menu .item').filter({hasText: 'user4'}).click();
await page.locator('.select-assignees-modify.dropdown').click();
await page.waitForLoadState('networkidle');
await expect(assigneesList.filter({hasText: 'user4'})).toBeVisible();
// remove user4
await page.locator('.select-assignees-modify.dropdown').click();
await page.locator('.select-assignees-modify .menu .item').filter({hasText: 'user4'}).click();
await page.locator('.select-assignees-modify.dropdown').click();
await page.waitForLoadState('networkidle');
await expect(page.locator('.ui.assignees.list .item.no-select')).toBeVisible();
await expect(assigneesList.filter({hasText: 'user4'})).toBeHidden();
// Test assign me
await page.locator('.ui.assignees .select-assign-me').click();
await page.waitForLoadState('networkidle');
await expect(assigneesList.filter({hasText: 'user2'})).toBeVisible();
await expect(page.locator('.ui.assignees.list .item.no-select')).toBeHidden();
});
@ -186,6 +183,7 @@ test('New Issue: Assignees', async ({browser}, workerInfo) => {
await page.locator('.select-assignees.dropdown').click();
await page.fill('.select-assignees .menu .search input', '');
await page.locator('.select-assignees.dropdown .no-select.item').click();
await expect(page.locator('.select-assign-me')).toBeVisible();
});
test('Issue: Milestone', async ({browser}, workerInfo) => {

View file

@ -256,7 +256,7 @@ export function initRepoCommentForm() {
icon = svg('octicon-milestone', 18, 'tw-mr-2');
} else if (input_id === '#project_id') {
icon = svg('octicon-project', 18, 'tw-mr-2');
} else if (input_id === '#assignee_id') {
} else if (input_id === '#assignee_ids') {
icon = `<img class="ui avatar image tw-mr-2" alt="avatar" src=${$(this).data('avatar')}>`;
}
@ -296,7 +296,7 @@ export function initRepoCommentForm() {
// Milestone, Assignee, Project
selectItem('.select-project', '#project_id');
selectItem('.select-milestone', '#milestone_id');
selectItem('.select-assignee', '#assignee_id');
selectItem('.select-assignee', '#assignee_ids');
}
async function onEditContent(event) {