Merge pull request 'fix: Small fixes and rename for #5482' (#5505) from timedin/forgejo:forgejo into forgejo
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (map[image:docker.io/bitnami/redis:7.2 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:docker.io/bitnami/valkey:7.2 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:ghcr.io/microsoft/garnet-alpine:1.0.14 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:registry.redict.io/redict:7.3.0-scratch port:6379]) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions

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 { type CreateIssueForm struct {
Title string `binding:"Required;MaxSize(255)"` Title string `binding:"Required;MaxSize(255)"`
LabelIDs string `form:"label_ids"` LabelIDs string `form:"label_ids"`
AssigneeIDs string `form:"assignee_id"` AssigneeIDs string `form:"assignee_ids"`
Ref string `form:"ref"` Ref string `form:"ref"`
MilestoneID int64 MilestoneID int64
ProjectID 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"> <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"> <a class="text muted flex-text-block">
<strong>{{ctx.Locale.Tr "repo.issues.new.assignees"}}</strong> <strong>{{ctx.Locale.Tr "repo.issues.new.assignees"}}</strong>
@ -6,7 +6,7 @@
{{svg "octicon-gear" 16 "tw-ml-1"}} {{svg "octicon-gear" 16 "tw-ml-1"}}
{{end}} {{end}}
</a> </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"> <div class="ui icon search input">
<i class="icon">{{svg "octicon-search" 16}}</i> <i class="icon">{{svg "octicon-search" 16}}</i>
<input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignees"}}"> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignees"}}">
@ -36,7 +36,7 @@
{{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}
{{with index .Assignees 0}} {{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"}} {{ctx.Locale.Tr "repo.issues.new.assign_to_me"}}
</a> </a>
{{end}} {{end}}

View file

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

View file

@ -256,7 +256,7 @@ export function initRepoCommentForm() {
icon = svg('octicon-milestone', 18, 'tw-mr-2'); icon = svg('octicon-milestone', 18, 'tw-mr-2');
} else if (input_id === '#project_id') { } else if (input_id === '#project_id') {
icon = svg('octicon-project', 18, 'tw-mr-2'); 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')}>`; 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 // Milestone, Assignee, Project
selectItem('.select-project', '#project_id'); selectItem('.select-project', '#project_id');
selectItem('.select-milestone', '#milestone_id'); selectItem('.select-milestone', '#milestone_id');
selectItem('.select-assignee', '#assignee_id'); selectItem('.select-assignee', '#assignee_ids');
} }
async function onEditContent(event) { async function onEditContent(event) {