The Wayback Machine - https://web.archive.org/web/20220211083138/https://github.com/go-gitea/gitea/pull/16958
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

Add repo_id for attachment #16958

merged 19 commits into from Sep 8, 2021

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 kind/bug 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
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
6543
6543 approved these changes Sep 5, 2021
@codecov-commenter
Copy link

@codecov-commenter codecov-commenter commented Sep 5, 2021

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.

axifive
axifive approved these changes Sep 8, 2021
@6543
Copy link
Member

@6543 6543 commented Sep 8, 2021

🚀

@6543 6543 merged commit ddc709f into go-gitea:main Sep 8, 2021
2 checks passed
@lunny lunny deleted the lunny/add_attachment_repoid branch Sep 8, 2021
@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.
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants