mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-02-23 11:55:48 -05:00
chore: Remove DeleteAttachmentsByIssue
- Introduced in4617bef895
and removed inab2d0b3b44
.
This commit is contained in:
parent
7481624273
commit
901b32ce16
3 changed files with 1 additions and 16 deletions
|
@ -65,7 +65,6 @@ code.gitea.io/gitea/models/project
|
|||
ChangeProjectStatus
|
||||
|
||||
code.gitea.io/gitea/models/repo
|
||||
DeleteAttachmentsByIssue
|
||||
WatchRepoMode
|
||||
|
||||
code.gitea.io/gitea/models/user
|
||||
|
|
|
@ -219,16 +219,6 @@ func DeleteAttachments(ctx context.Context, attachments []*Attachment, remove bo
|
|||
return int(cnt), nil
|
||||
}
|
||||
|
||||
// DeleteAttachmentsByIssue deletes all attachments associated with the given issue.
|
||||
func DeleteAttachmentsByIssue(ctx context.Context, issueID int64, remove bool) (int, error) {
|
||||
attachments, err := GetAttachmentsByIssueID(ctx, issueID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return DeleteAttachments(ctx, attachments, remove)
|
||||
}
|
||||
|
||||
// DeleteAttachmentsByComment deletes all attachments associated with the given comment.
|
||||
func DeleteAttachmentsByComment(ctx context.Context, commentID int64, remove bool) (int, error) {
|
||||
attachments, err := GetAttachmentsByCommentID(ctx, commentID)
|
||||
|
|
|
@ -46,11 +46,7 @@ func TestGetByCommentOrIssueID(t *testing.T) {
|
|||
func TestDeleteAttachments(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
count, err := repo_model.DeleteAttachmentsByIssue(db.DefaultContext, 4, false)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, count)
|
||||
|
||||
count, err = repo_model.DeleteAttachmentsByComment(db.DefaultContext, 2, false)
|
||||
count, err := repo_model.DeleteAttachmentsByComment(db.DefaultContext, 2, false)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, count)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue