@@ -114,12 +114,12 @@ func (a *Action) GetOpType() ActionType {
114
114
}
115
115
116
116
// LoadActUser loads a.ActUser
117
- func (a * Action ) LoadActUser () {
117
+ func (a * Action ) LoadActUser (ctx context. Context ) {
118
118
if a .ActUser != nil {
119
119
return
120
120
}
121
121
var err error
122
- a .ActUser , err = user_model .GetUserByID (a .ActUserID )
122
+ a .ActUser , err = user_model .GetUserByID (ctx , a .ActUserID )
123
123
if err == nil {
124
124
return
125
125
} else if user_model .IsErrUserNotExist (err ) {
@@ -129,26 +129,26 @@ func (a *Action) LoadActUser() {
129
129
}
130
130
}
131
131
132
- func (a * Action ) loadRepo () {
132
+ func (a * Action ) loadRepo (ctx context. Context ) {
133
133
if a .Repo != nil {
134
134
return
135
135
}
136
136
var err error
137
- a .Repo , err = repo_model .GetRepositoryByID (a .RepoID )
137
+ a .Repo , err = repo_model .GetRepositoryByID (ctx , a .RepoID )
138
138
if err != nil {
139
139
log .Error ("repo_model.GetRepositoryByID(%d): %v" , a .RepoID , err )
140
140
}
141
141
}
142
142
143
143
// GetActFullName gets the action's user full name.
144
144
func (a * Action ) GetActFullName () string {
145
- a .LoadActUser ()
145
+ a .LoadActUser (db . DefaultContext )
146
146
return a .ActUser .FullName
147
147
}
148
148
149
149
// GetActUserName gets the action's user name.
150
150
func (a * Action ) GetActUserName () string {
151
- a .LoadActUser ()
151
+ a .LoadActUser (db . DefaultContext )
152
152
return a .ActUser .Name
153
153
}
154
154
@@ -179,7 +179,7 @@ func (a *Action) GetDisplayNameTitle() string {
179
179
180
180
// GetRepoUserName returns the name of the action repository owner.
181
181
func (a * Action ) GetRepoUserName () string {
182
- a .loadRepo ()
182
+ a .loadRepo (db . DefaultContext )
183
183
return a .Repo .OwnerName
184
184
}
185
185
@@ -191,7 +191,7 @@ func (a *Action) ShortRepoUserName() string {
191
191
192
192
// GetRepoName returns the name of the action repository.
193
193
func (a * Action ) GetRepoName () string {
194
- a .loadRepo ()
194
+ a .loadRepo (db . DefaultContext )
195
195
return a .Repo .Name
196
196
}
197
197
@@ -379,7 +379,7 @@ func activityQueryCondition(opts GetFeedsOptions) (builder.Cond, error) {
379
379
cond := builder .NewCond ()
380
380
381
381
if opts .RequestedTeam != nil && opts .RequestedUser == nil {
382
- org , err := user_model .GetUserByID (opts .RequestedTeam .OrgID )
382
+ org , err := user_model .GetUserByID (db . DefaultContext , opts .RequestedTeam .OrgID )
383
383
if err != nil {
384
384
return nil , err
385
385
}
@@ -489,7 +489,7 @@ func NotifyWatchers(ctx context.Context, actions ...*Action) error {
489
489
}
490
490
491
491
if repoChanged {
492
- act .loadRepo ()
492
+ act .loadRepo (ctx )
493
493
repo = act .Repo
494
494
495
495
// check repo owner exist.
@@ -514,7 +514,7 @@ func NotifyWatchers(ctx context.Context, actions ...*Action) error {
514
514
permIssue = make ([]bool , len (watchers ))
515
515
permPR = make ([]bool , len (watchers ))
516
516
for i , watcher := range watchers {
517
- user , err := user_model .GetUserByIDCtx (ctx , watcher .UserID )
517
+ user , err := user_model .GetUserByID (ctx , watcher .UserID )
518
518
if err != nil {
519
519
permCode [i ] = false
520
520
permIssue [i ] = false
0 commit comments