@@ -232,7 +232,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
232232	}
233233
234234	if  len (addTags )+ len (delTags ) >  0  {
235- 		if  err  :=  PushUpdateAddDeleteTags (ctx , repo , gitRepo , addTags , delTags ); err  !=  nil  {
235+ 		if  err  :=  PushUpdateAddDeleteTags (ctx , repo , gitRepo , pusher ,  addTags , delTags ); err  !=  nil  {
236236			return  fmt .Errorf ("PushUpdateAddDeleteTags: %w" , err )
237237		}
238238	}
@@ -342,17 +342,17 @@ func pushDeleteBranch(ctx context.Context, repo *repo_model.Repository, pusher *
342342}
343343
344344// PushUpdateAddDeleteTags updates a number of added and delete tags 
345- func  PushUpdateAddDeleteTags (ctx  context.Context , repo  * repo_model.Repository , gitRepo  * git.Repository , addTags , delTags  []string ) error  {
345+ func  PushUpdateAddDeleteTags (ctx  context.Context , repo  * repo_model.Repository , gitRepo  * git.Repository , pusher   * user_model. User ,  addTags , delTags  []string ) error  {
346346	return  db .WithTx (ctx , func (ctx  context.Context ) error  {
347347		if  err  :=  repo_model .PushUpdateDeleteTags (ctx , repo , delTags ); err  !=  nil  {
348348			return  err 
349349		}
350- 		return  pushUpdateAddTags (ctx , repo , gitRepo , addTags )
350+ 		return  pushUpdateAddTags (ctx , repo , gitRepo , pusher ,  addTags )
351351	})
352352}
353353
354354// pushUpdateAddTags updates a number of add tags 
355- func  pushUpdateAddTags (ctx  context.Context , repo  * repo_model.Repository , gitRepo  * git.Repository , tags  []string ) error  {
355+ func  pushUpdateAddTags (ctx  context.Context , repo  * repo_model.Repository , gitRepo  * git.Repository , pusher   * user_model. User ,  tags  []string ) error  {
356356	if  len (tags ) ==  0  {
357357		return  nil 
358358	}
@@ -378,8 +378,6 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
378378
379379	newReleases  :=  make ([]* repo_model.Release , 0 , len (lowerTags )- len (relMap ))
380380
381- 	emailToUser  :=  make (map [string ]* user_model.User )
382- 
383381	for  i , lowerTag  :=  range  lowerTags  {
384382		tag , err  :=  gitRepo .GetTag (tags [i ])
385383		if  err  !=  nil  {
@@ -397,21 +395,9 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
397395		if  sig  ==  nil  {
398396			sig  =  commit .Committer 
399397		}
400- 		var  author  * user_model.User 
401- 		createdAt  :=  time .Unix (1 , 0 )
402398
399+ 		createdAt  :=  time .Unix (1 , 0 )
403400		if  sig  !=  nil  {
404- 			var  ok  bool 
405- 			author , ok  =  emailToUser [sig .Email ]
406- 			if  ! ok  {
407- 				author , err  =  user_model .GetUserByEmail (ctx , sig .Email )
408- 				if  err  !=  nil  &&  ! user_model .IsErrUserNotExist (err ) {
409- 					return  fmt .Errorf ("GetUserByEmail: %w" , err )
410- 				}
411- 				if  author  !=  nil  {
412- 					emailToUser [sig .Email ] =  author 
413- 				}
414- 			}
415401			createdAt  =  sig .When 
416402		}
417403
@@ -435,11 +421,9 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
435421				IsDraft :      false ,
436422				IsPrerelease : false ,
437423				IsTag :        true ,
424+ 				PublisherID :  pusher .ID ,
438425				CreatedUnix :  timeutil .TimeStamp (createdAt .Unix ()),
439426			}
440- 			if  author  !=  nil  {
441- 				rel .PublisherID  =  author .ID 
442- 			}
443427
444428			newReleases  =  append (newReleases , rel )
445429		} else  {
@@ -448,12 +432,10 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
448432			if  rel .IsTag  {
449433				rel .Title  =  parts [0 ]
450434				rel .Note  =  note 
451- 				if  author  !=  nil  {
452- 					rel .PublisherID  =  author .ID 
453- 				}
454435			} else  {
455436				rel .IsDraft  =  false 
456437			}
438+ 			rel .PublisherID  =  pusher .ID 
457439			if  err  =  repo_model .UpdateRelease (ctx , rel ); err  !=  nil  {
458440				return  fmt .Errorf ("Update: %w" , err )
459441			}
0 commit comments