@@ -114,12 +114,12 @@ func (a *Action) GetOpType() ActionType {
114114}
115115
116116// LoadActUser loads a.ActUser
117- func (a * Action ) LoadActUser () {
117+ func (a * Action ) LoadActUser (ctx context. Context ) {
118118 if a .ActUser != nil {
119119 return
120120 }
121121 var err error
122- a .ActUser , err = user_model .GetUserByID (a .ActUserID )
122+ a .ActUser , err = user_model .GetUserByID (ctx , a .ActUserID )
123123 if err == nil {
124124 return
125125 } else if user_model .IsErrUserNotExist (err ) {
@@ -129,26 +129,26 @@ func (a *Action) LoadActUser() {
129129 }
130130}
131131
132- func (a * Action ) loadRepo () {
132+ func (a * Action ) loadRepo (ctx context. Context ) {
133133 if a .Repo != nil {
134134 return
135135 }
136136 var err error
137- a .Repo , err = repo_model .GetRepositoryByID (a .RepoID )
137+ a .Repo , err = repo_model .GetRepositoryByID (ctx , a .RepoID )
138138 if err != nil {
139139 log .Error ("repo_model.GetRepositoryByID(%d): %v" , a .RepoID , err )
140140 }
141141}
142142
143143// GetActFullName gets the action's user full name.
144144func (a * Action ) GetActFullName () string {
145- a .LoadActUser ()
145+ a .LoadActUser (db . DefaultContext )
146146 return a .ActUser .FullName
147147}
148148
149149// GetActUserName gets the action's user name.
150150func (a * Action ) GetActUserName () string {
151- a .LoadActUser ()
151+ a .LoadActUser (db . DefaultContext )
152152 return a .ActUser .Name
153153}
154154
@@ -179,7 +179,7 @@ func (a *Action) GetDisplayNameTitle() string {
179179
180180// GetRepoUserName returns the name of the action repository owner.
181181func (a * Action ) GetRepoUserName () string {
182- a .loadRepo ()
182+ a .loadRepo (db . DefaultContext )
183183 return a .Repo .OwnerName
184184}
185185
@@ -191,7 +191,7 @@ func (a *Action) ShortRepoUserName() string {
191191
192192// GetRepoName returns the name of the action repository.
193193func (a * Action ) GetRepoName () string {
194- a .loadRepo ()
194+ a .loadRepo (db . DefaultContext )
195195 return a .Repo .Name
196196}
197197
@@ -379,7 +379,7 @@ func activityQueryCondition(opts GetFeedsOptions) (builder.Cond, error) {
379379 cond := builder .NewCond ()
380380
381381 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 )
383383 if err != nil {
384384 return nil , err
385385 }
@@ -489,7 +489,7 @@ func NotifyWatchers(ctx context.Context, actions ...*Action) error {
489489 }
490490
491491 if repoChanged {
492- act .loadRepo ()
492+ act .loadRepo (ctx )
493493 repo = act .Repo
494494
495495 // check repo owner exist.
@@ -514,7 +514,7 @@ func NotifyWatchers(ctx context.Context, actions ...*Action) error {
514514 permIssue = make ([]bool , len (watchers ))
515515 permPR = make ([]bool , len (watchers ))
516516 for i , watcher := range watchers {
517- user , err := user_model .GetUserByIDCtx (ctx , watcher .UserID )
517+ user , err := user_model .GetUserByID (ctx , watcher .UserID )
518518 if err != nil {
519519 permCode [i ] = false
520520 permIssue [i ] = false
0 commit comments