Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Upstream
Gitea
Commits
e7128e8c
Commit
e7128e8c
authored
6 years ago
by
Lunny Xiao
Committed by
Lauris BH
6 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix sqlite lock (#5176) (#5179)
* fix sqlite lock * fix sqlite lock on getUnitType
parent
274ff0d0
v1.6.4
v1.6.3
v1.6.2
v1.6.1
v1.6.0
v1.6.0-rc2
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
models/notification.go
+2
-2
models/notification.go
models/org_team.go
+5
-1
models/org_team.go
models/repo.go
+6
-2
models/repo.go
with
13 additions
and
5 deletions
+13
-5
models/notification.go
View file @
e7128e8c
...
...
@@ -123,10 +123,10 @@ func createOrUpdateIssueNotifications(e Engine, issue *Issue, notificationAuthor
for
_
,
watch
:=
range
watches
{
issue
.
Repo
.
Units
=
nil
if
issue
.
IsPull
&&
!
issue
.
Repo
.
C
heckUnitUser
(
watch
.
UserID
,
false
,
UnitTypePullRequests
)
{
if
issue
.
IsPull
&&
!
issue
.
Repo
.
c
heckUnitUser
(
e
,
watch
.
UserID
,
false
,
UnitTypePullRequests
)
{
continue
}
if
!
issue
.
IsPull
&&
!
issue
.
Repo
.
C
heckUnitUser
(
watch
.
UserID
,
false
,
UnitTypeIssues
)
{
if
!
issue
.
IsPull
&&
!
issue
.
Repo
.
c
heckUnitUser
(
e
,
watch
.
UserID
,
false
,
UnitTypeIssues
)
{
continue
}
...
...
This diff is collapsed.
Click to expand it.
models/org_team.go
View file @
e7128e8c
...
...
@@ -215,7 +215,11 @@ func (t *Team) RemoveRepository(repoID int64) error {
// UnitEnabled returns if the team has the given unit type enabled
func
(
t
*
Team
)
UnitEnabled
(
tp
UnitType
)
bool
{
if
err
:=
t
.
getUnits
(
x
);
err
!=
nil
{
return
t
.
unitEnabled
(
x
,
tp
)
}
func
(
t
*
Team
)
unitEnabled
(
e
Engine
,
tp
UnitType
)
bool
{
if
err
:=
t
.
getUnits
(
e
);
err
!=
nil
{
log
.
Warn
(
"Error loading repository (ID: %d) units: %s"
,
t
.
ID
,
err
.
Error
())
}
...
...
This diff is collapsed.
Click to expand it.
models/repo.go
View file @
e7128e8c
...
...
@@ -321,7 +321,11 @@ func (repo *Repository) getUnits(e Engine) (err error) {
// CheckUnitUser check whether user could visit the unit of this repository
func
(
repo
*
Repository
)
CheckUnitUser
(
userID
int64
,
isAdmin
bool
,
unitType
UnitType
)
bool
{
if
err
:=
repo
.
getUnitsByUserID
(
x
,
userID
,
isAdmin
);
err
!=
nil
{
return
repo
.
checkUnitUser
(
x
,
userID
,
isAdmin
,
unitType
)
}
func
(
repo
*
Repository
)
checkUnitUser
(
e
Engine
,
userID
int64
,
isAdmin
bool
,
unitType
UnitType
)
bool
{
if
err
:=
repo
.
getUnitsByUserID
(
e
,
userID
,
isAdmin
);
err
!=
nil
{
return
false
}
...
...
@@ -369,7 +373,7 @@ func (repo *Repository) getUnitsByUserID(e Engine, userID int64, isAdmin bool) (
var
newRepoUnits
=
make
([]
*
RepoUnit
,
0
,
len
(
repo
.
Units
))
for
_
,
u
:=
range
repo
.
Units
{
for
_
,
team
:=
range
teams
{
if
team
.
U
nitEnabled
(
u
.
Type
)
{
if
team
.
u
nitEnabled
(
e
,
u
.
Type
)
{
newRepoUnits
=
append
(
newRepoUnits
,
u
)
break
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help