1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-10-20 19:52:04 +00:00

[v12.0/forgejo] fix(api): deactivate issue api for disabled or external issue-tracker (#9147)

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/8829

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

Co-authored-by: zokki <zokki.softwareschmiede@gmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9147
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
forgejo-backport-action 2025-09-03 16:47:02 +02:00 committed by Gusted
parent 19d920931d
commit 88e18dea4a
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"
@ -506,3 +509,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()
}