fix(api): deactivate issue api for disabled or external issue-tracker (#8829)

- When the issue unit is disabled for a repository, don't allow issue related APIs.
- Added integration tests.
- Resolves #8408

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8829
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: zokki <zokki.softwareschmiede@gmail.com>
Co-committed-by: zokki <zokki.softwareschmiede@gmail.com>
This commit is contained in:
zokki 2025-09-03 16:13:40 +02:00 committed by Gusted
commit 4247c37300
7 changed files with 252 additions and 75 deletions

View file

@ -5,9 +5,12 @@
package tests
import (
"bytes"
"context"
"database/sql"
"fmt"
"io"
"mime/multipart"
"os"
"path"
"path/filepath"
@ -524,3 +527,13 @@ func CreateDeclarativeRepo(t *testing.T, owner *user_model.User, name string, en
return CreateDeclarativeRepoWithOptions(t, owner, opts)
}
func WriteImageBody(t *testing.T, buff bytes.Buffer, filename string, body *bytes.Buffer) string {
writer := multipart.NewWriter(body)
defer writer.Close()
part, err := writer.CreateFormFile("attachment", filename)
require.NoError(t, err)
_, err = io.Copy(part, &buff)
require.NoError(t, err)
return writer.FormDataContentType()
}