Skip to content
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 repo_id for attachment #16958

Merged
merged 19 commits into from
Sep 8, 2021
Merged

Conversation

lunny
Copy link
Member

@lunny lunny commented Sep 5, 2021

When create a new issue or comment and paste/upload an attachment/image, it will not assign an issue id before submit. So if user give up the creating, the attachments will lost key feature and become dirty content. We don't know if we need to delete the attachment even if the repository deleted.

This PR add a repo_id in attachment table so that even if a new upload attachment with no issue_id or release_id but should have repo_id. When deleting a repository, they could also be deleted.

@lunny lunny added the type/bug label Sep 5, 2021
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 5, 2021
models/repo.go Outdated Show resolved Hide resolved
models/migrations/v193.go Outdated Show resolved Hide resolved
services/wiki/wiki.go Outdated Show resolved Hide resolved
@6543 6543 added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Sep 5, 2021
models/migrations/v193_test.go Outdated Show resolved Hide resolved
models/migrations/v193.go Outdated Show resolved Hide resolved
models/migrations/v193.go Outdated Show resolved Hide resolved
@lunny lunny added this to the 1.16.0 milestone Sep 5, 2021
models/fixtures/attachment.yml Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 5, 2021
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@0767fe0). Click here to learn what that means.
The diff coverage is 52.85%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16958   +/-   ##
=======================================
  Coverage        ?   45.18%           
=======================================
  Files           ?      763           
  Lines           ?    86208           
  Branches        ?        0           
=======================================
  Hits            ?    38952           
  Misses          ?    40955           
  Partials        ?     6301           
Impacted Files Coverage Δ
models/attachment.go 58.77% <ø> (ø)
routers/api/v1/repo/release_attachment.go 0.00% <0.00%> (ø)
routers/web/repo/setting.go 14.41% <0.00%> (ø)
services/wiki/wiki.go 57.07% <0.00%> (ø)
routers/web/repo/attachment.go 37.80% <42.85%> (ø)
models/repo.go 54.50% <50.00%> (ø)
services/attachment/attachment.go 75.00% <75.00%> (ø)
models/context.go 57.14% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0767fe0...d4db913. Read the comment docs.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 8, 2021
@6543
Copy link
Member

6543 commented Sep 8, 2021

🚀

@6543 6543 merged commit ddc709f into go-gitea:main Sep 8, 2021
@lunny lunny deleted the lunny/add_attachment_repoid branch September 8, 2021 15:35
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants