-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API management for issue/pull and comment attachments #21783
Merged
Merged
Changes from 56 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
f9595c3
[API] Add issue and comment attachments
andrebruch 04abe85
Specify capacity for assets slice
andrebruch bef0c92
Make comment attachments accessible
andrebruch 10d7f90
Update attachments in correct order
andrebruch 806143c
Fix: Notifications for API attachments
andrebruch dc49872
Fix: new line in v1_json.tmpl
andrebruch 7393e67
Fix import order
andrebruch 488a072
Fix missed return
andrebruch 7ac28eb
Merge branch 'master' into feature-add-issue-and-comment-attachments-api
zeripath 6e3cf41
Merge remote-tracking branch 'origin/main' into feature-add-issue-and…
zeripath 7dff40d
Merge branch 'main' into feature-add-issue-and-comment-attachments-api
6543 75785e1
partial correction of permissions checks
zeripath 202ece1
Fix title of error
andrebruch 587605e
Merge functions ToIssueAttachment and ToCommentAttachment
andrebruch 036dd17
deduplicate convert.ToAttachment()
noerw 9c433e5
refer to issue by index, not by ID..
noerw 065d88f
Merge branch 'master' into feature-add-issue-and-comment-attachments-api
6543 d883f69
use attachment_service.UploadAttachment()
noerw e98bf3e
fix permissions of *IssueAttachment()
noerw f2a05e7
WIP: fix permissions of *IssueCommentAttachment()
noerw ad9a947
rm dublicate func
6543 f99ee82
update swagger
6543 5134ff6
fixup! fix permissions of *IssueAttachment()
noerw 7557df1
fix permissions of *IssueCommentAttachment() (cont)
noerw 170134a
move all asset APIs into issue / comment namespace
noerw a776dc2
fix swagger docs
noerw bfafd9d
fix updating issue
noerw ed6d55e
Merge branch 'main' into feature-add-issue-and-comment-attachments-api
6543 6b521f2
Correct the year of the code contribution
andrebruch e5633d8
Merge branch 'main' into feature-add-issue-and-comment-attachments-api
6543 32e8508
fix errors
noerw d32924d
Fix call of GetIssueByIndex and correction of grammar errors
andrebruch 500d163
Merge branch 'main' into feature-add-issue-and-comment-attachments-api
andrebruch 1459011
Remove redundant `return` statement
andrebruch 6d6b858
make generate-swagger
andrebruch 6517302
Add newline to v1_json.tmpl
andrebruch cbd1a77
[API] Add integration tests for issue attachments
andrebruch 992b8ec
Merge branch 'main' into feature-add-issue-and-comment-attachments-api
6543 9227070
[API] Add integration tests for comment attachments
andrebruch d05625b
Merge branch 'main' into feature-add-issue-and-comment-attachments-api
6543 e39c3de
Merge branch 'master' into feature-add-issue-and-comment-attachments-api
6543 fbab446
adapt latest refactors
6543 c8cafc0
rm merge conflict resolve
6543 5bd533c
format & fix
6543 92d527b
Merge remote-tracking branch 'andre/feature-add-issue-and-comment-att…
KN4CK3R 91c93ed
Add issue/pull permission check.
KN4CK3R b0461f4
Add issue/comment read access check.
KN4CK3R 27e324a
Fix error log.
KN4CK3R beee20b
lint
KN4CK3R 7fd332e
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R 57b5f31
Merge remote-tracking branch 'origin/main' into feature-api-attachment
zeripath cf93210
placate spdx
zeripath 5687791
reduce duplication and remove old ToIssueAttachment
zeripath 8848e0b
attachment not attachEment
zeripath 5438207
use ToAttachments instead
zeripath 4f5e61c
wrap errors too
zeripath 7e49218
Merge branch 'main' into feature-api-attachment
zeripath 5fa0b6b
Merge branch 'main' into feature-api-attachment
lunny 7738345
Merge branch 'main' into feature-api-attachment
lunny f839f8f
Merge branch 'main' into feature-api-attachment
lunny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2021 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package convert | ||
|
||
import ( | ||
repo_model "code.gitea.io/gitea/models/repo" | ||
api "code.gitea.io/gitea/modules/structs" | ||
) | ||
|
||
// ToAttachment converts models.Attachment to api.Attachment | ||
func ToAttachment(a *repo_model.Attachment) *api.Attachment { | ||
return &api.Attachment{ | ||
ID: a.ID, | ||
Name: a.Name, | ||
Created: a.CreatedUnix.AsTime(), | ||
DownloadCount: a.DownloadCount, | ||
Size: a.Size, | ||
UUID: a.UUID, | ||
DownloadURL: a.DownloadURL(), | ||
} | ||
} | ||
|
||
func ToAttachments(attachments []*repo_model.Attachment) []*api.Attachment { | ||
converted := make([]*api.Attachment, 0, len(attachments)) | ||
for _, attachment := range attachments { | ||
converted = append(converted, ToAttachment(attachment)) | ||
} | ||
return converted | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little curious, why it's called
assets
in JSON (and route path), it introduces unnecessary inconsistency IMO.