mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 06:38:37 -04:00 
			
		
		
		
	* Report the correct number of pushes on the feeds Since the number of commits in the Action table has been limited to 5 the number of commits reported on the feeds page is now incorrectly also limited to 5. The correct number is available as the Len and this PR changes this to report this. Fix #16804 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update templates/user/dashboard/feeds.tmpl Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
		| @@ -31,6 +31,7 @@ type PushCommits struct { | |||||||
| 	Commits    []*PushCommit | 	Commits    []*PushCommit | ||||||
| 	HeadCommit *PushCommit | 	HeadCommit *PushCommit | ||||||
| 	CompareURL string | 	CompareURL string | ||||||
|  | 	Len        int | ||||||
|  |  | ||||||
| 	avatars    map[string]string | 	avatars    map[string]string | ||||||
| 	emailUsers map[string]*models.User | 	emailUsers map[string]*models.User | ||||||
| @@ -182,5 +183,12 @@ func ListToPushCommits(l *list.List) *PushCommits { | |||||||
| 		commit := CommitToPushCommit(e.Value.(*git.Commit)) | 		commit := CommitToPushCommit(e.Value.(*git.Commit)) | ||||||
| 		commits = append(commits, commit) | 		commits = append(commits, commit) | ||||||
| 	} | 	} | ||||||
| 	return &PushCommits{commits, nil, "", make(map[string]string), make(map[string]*models.User)} | 	return &PushCommits{ | ||||||
|  | 		Commits:    commits, | ||||||
|  | 		HeadCommit: nil, | ||||||
|  | 		CompareURL: "", | ||||||
|  | 		Len:        len(commits), | ||||||
|  | 		avatars:    make(map[string]string), | ||||||
|  | 		emailUsers: make(map[string]*models.User), | ||||||
|  | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -848,6 +848,11 @@ func ActionContent2Commits(act Actioner) *repository.PushCommits { | |||||||
| 	if err := json.Unmarshal([]byte(act.GetContent()), push); err != nil { | 	if err := json.Unmarshal([]byte(act.GetContent()), push); err != nil { | ||||||
| 		log.Error("json.Unmarshal:\n%s\nERROR: %v", act.GetContent(), err) | 		log.Error("json.Unmarshal:\n%s\nERROR: %v", act.GetContent(), err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if push.Len == 0 { | ||||||
|  | 		push.Len = len(push.Commits) | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	return push | 	return push | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -101,7 +101,7 @@ | |||||||
| 										</li> | 										</li> | ||||||
| 									{{end}} | 									{{end}} | ||||||
| 								{{end}} | 								{{end}} | ||||||
| 								{{if and (gt (len $push.Commits) 1) $push.CompareURL}}<li><a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{$.i18n.Tr "action.compare_commits" (len $push.Commits)}} »</a></li>{{end}} | 								{{if and (gt $push.Len 1) $push.CompareURL}}<li><a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{$.i18n.Tr "action.compare_commits" $push.Len}} »</a></li>{{end}} | ||||||
| 							</ul> | 							</ul> | ||||||
| 						</div> | 						</div> | ||||||
| 					{{else if eq .GetOpType 6}} | 					{{else if eq .GetOpType 6}} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user