mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-03 00:45:22 +02:00
Ensure that sessions are passed into queries that could use the database to prevent deadlocks (#5718)
* Fixed deadlock in CreateComment * Fix possible deadlock in UpdateIssueDeadline from createDeadlineComment * Ensure that calls to IsTimeTracker enabled are called within session Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure that calls to reactionList are also called within session Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure all calls in NewPullRequest with the session are called within the session Signed-off-by: Andrew Thornton <art27@cantab.net> * Deal with potential deadlocks in repo Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure that isStaring is checked within our transaction Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix mistake in isOrganizationMember Sorry.
This commit is contained in:
parent
656456441c
commit
6868378673
6 changed files with 42 additions and 22 deletions
|
@ -314,7 +314,11 @@ func IsOrganizationOwner(orgID, uid int64) (bool, error) {
|
|||
|
||||
// IsOrganizationMember returns true if given user is member of organization.
|
||||
func IsOrganizationMember(orgID, uid int64) (bool, error) {
|
||||
return x.
|
||||
return isOrganizationMember(x, orgID, uid)
|
||||
}
|
||||
|
||||
func isOrganizationMember(e Engine, orgID, uid int64) (bool, error) {
|
||||
return e.
|
||||
Where("uid=?", uid).
|
||||
And("org_id=?", orgID).
|
||||
Table("org_user").
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue