summaryrefslogtreecommitdiffstats
path: root/models/context.go
Commit message (Collapse)AuthorAgeFilesLines
* Move db related basic functions to models/db (#17075)Lunny Xiao2021-09-191-71/+0
| | | | | | | | | | | | | | | | | | | | | | | | | * Move db related basic functions to models/db * Fix lint * Fix lint * Fix test * Fix lint * Fix lint * revert unnecessary change * Fix test * Fix wrong replace string * Use *Context * Correct committer spelling and fix wrong replaced words Co-authored-by: zeripath <art27@cantab.net>
* Correctly rollback in ForkRepository (#17034)zeripath2021-09-141-5/+2
| | | | | | | | | | | | | The rollback functionality in services/repository/repository.go:ForkRepository is incorrect and could lead to a deadlock as it uses DeleteRepository to delete the rolled-back repository - a function which creates its own transaction. This PR adjusts the rollback function to only use RemoveAll as any database changes will be automatically rolled-back. It also handles panics and adjusts the Close within WithTx to ensure that if there is a panic the session will always be closed. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add repo_id for attachment (#16958)Lunny Xiao2021-09-081-0/+6
| | | | | | | 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. Co-authored-by: 6543 <6543@obermui.de>
* Fix various documentation, user-facing, and source comment typos (#16367)luzpaz2021-07-081-1/+1
| | | | | * Fix various doc, user-facing, and source comment typos Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby`
* Upgrade xorm to v1.0.2 (#11900)Lunny Xiao2020-06-151-1/+1
| | | Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Refactor repository check and sync functions (#9854)Lunny Xiao2020-01-201-0/+13
| | | Move more general repository functions out of models/repo.go
* Move all mail related codes from models to services/mailer (#7200)Lunny Xiao2019-09-241-0/+55
* move all mail related codes from models to modules/mailer * fix lint * use DBContext instead Engine * use WithContext not WithEngine * Use DBContext instead of Engine * don't use defer when sess.Close() * move DBContext to context.go and add some methods * move mailer from modules/ to services * fix lint * fix tests * fix fmt * add gitea copyright * fix tests * don't expose db functions * make code clear * add DefaultDBContext * fix build * fix bug