mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-11 00:10:38 -05:00
fix(projects): allow max columns to the limit (#39272)
Signed-off-by: Petr Vaněk <pevadev@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -138,7 +138,7 @@ func createDefaultColumnsForProject(ctx context.Context, project *Project) error
|
|||||||
|
|
||||||
// maxProjectColumns max columns allowed in a project, this should not bigger than 127
|
// maxProjectColumns max columns allowed in a project, this should not bigger than 127
|
||||||
// because sorting is int8 in database
|
// because sorting is int8 in database
|
||||||
const maxProjectColumns = 20
|
const maxProjectColumns = 127
|
||||||
|
|
||||||
// NewColumn adds a new project column to a given project
|
// NewColumn adds a new project column to a given project
|
||||||
func NewColumn(ctx context.Context, column *Column) error {
|
func NewColumn(ctx context.Context, column *Column) error {
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ func Test_NewColumn(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
err = NewColumn(t.Context(), &Column{
|
err = NewColumn(t.Context(), &Column{
|
||||||
Title: "column-21",
|
Title: fmt.Sprintf("column-%d", maxProjectColumns+1),
|
||||||
ProjectID: project1.ID,
|
ProjectID: project1.ID,
|
||||||
})
|
})
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ func AddColumnToProjectPost(ctx *context.Context) {
|
|||||||
Color: form.Color,
|
Color: form.Color,
|
||||||
CreatorID: ctx.Doer.ID,
|
CreatorID: ctx.Doer.ID,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
ctx.ServerError("NewProjectColumn", err)
|
ctx.JSONErrorAuto(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ func EditProjectColumn(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := project_model.UpdateColumn(ctx, column); err != nil {
|
if err := project_model.UpdateColumn(ctx, column); err != nil {
|
||||||
ctx.ServerError("UpdateProjectColumn", err)
|
ctx.JSONErrorAuto(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {contrastColor} from '../utils/color.ts';
|
import {contrastColor} from '../utils/color.ts';
|
||||||
import {createSortable} from '../modules/sortable.ts';
|
import {createSortable} from '../modules/sortable.ts';
|
||||||
import {POST, request} from '../modules/fetch.ts';
|
import {POST} from '../modules/fetch.ts';
|
||||||
|
import {performFetchActionRequest} from '../modules/fetch-action.ts';
|
||||||
import {hideFomanticModal} from '../modules/fomantic/modal.ts';
|
import {hideFomanticModal} from '../modules/fomantic/modal.ts';
|
||||||
import {queryElemChildren, queryElems, toggleElem} from '../utils/dom.ts';
|
import {queryElemChildren, queryElems, toggleElem} from '../utils/dom.ts';
|
||||||
import type {SortableEvent} from 'sortablejs';
|
import type {SortableEvent} from 'sortablejs';
|
||||||
@@ -113,7 +114,8 @@ function initRepoProjectColumnEdit(writableProjectBoard: Element): void {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
elForm.classList.add('is-loading');
|
elForm.classList.add('is-loading');
|
||||||
await request(formLink, {method: formMethod, data: formData});
|
const resp = await performFetchActionRequest(elForm, {url: formLink, method: formMethod, data: formData});
|
||||||
|
if (!resp) return;
|
||||||
if (!columnId) {
|
if (!columnId) {
|
||||||
window.location.reload(); // newly added column, need to reload the page
|
window.location.reload(); // newly added column, need to reload the page
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user