mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Print PR-Title into tooltip for actions (#35579)
This PR updates the tooltip for Pull-Request triggered runs to show the PR title instead of the PR number. --- I dont remember PR numbers, so having the title in the tooltip makes it much easier to recognize the right one 😊 Current <img width="290" height="88" alt="Screenshot 2025-10-03 231547" src="https://github.com/user-attachments/assets/dd8d264d-933f-4fb1-a945-82b172f95861" /> After <img width="301" height="91" alt="Screenshot 2025-10-03 224628" src="https://github.com/user-attachments/assets/74c9809a-c09a-4804-bb27-79058a99238b" /> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		@@ -102,6 +102,15 @@ func (run *ActionRun) PrettyRef() string {
 | 
				
			|||||||
	return refName.ShortName()
 | 
						return refName.ShortName()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// RefTooltip return a tooltop of run's ref. For pull request, it's the title of the PR, otherwise it's the ShortName.
 | 
				
			||||||
 | 
					func (run *ActionRun) RefTooltip() string {
 | 
				
			||||||
 | 
						payload, err := run.GetPullRequestEventPayload()
 | 
				
			||||||
 | 
						if err == nil && payload != nil && payload.PullRequest != nil {
 | 
				
			||||||
 | 
							return payload.PullRequest.Title
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return git.RefName(run.Ref).ShortName()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LoadAttributes load Repo TriggerUser if not loaded
 | 
					// LoadAttributes load Repo TriggerUser if not loaded
 | 
				
			||||||
func (run *ActionRun) LoadAttributes(ctx context.Context) error {
 | 
					func (run *ActionRun) LoadAttributes(ctx context.Context) error {
 | 
				
			||||||
	if run == nil {
 | 
						if run == nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,9 +28,9 @@
 | 
				
			|||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			<div class="flex-item-trailing">
 | 
								<div class="flex-item-trailing">
 | 
				
			||||||
				{{if $run.IsRefDeleted}}
 | 
									{{if $run.IsRefDeleted}}
 | 
				
			||||||
					<span class="ui label run-list-ref gt-ellipsis tw-line-through" data-tooltip-content="{{$run.PrettyRef}}">{{$run.PrettyRef}}</span>
 | 
										<span class="ui label run-list-ref gt-ellipsis tw-line-through" data-tooltip-content="{{$run.RefTooltip}}">{{$run.PrettyRef}}</span>
 | 
				
			||||||
				{{else}}
 | 
									{{else}}
 | 
				
			||||||
					<a class="ui label run-list-ref gt-ellipsis" href="{{$run.RefLink}}" data-tooltip-content="{{$run.PrettyRef}}">{{$run.PrettyRef}}</a>
 | 
										<a class="ui label run-list-ref gt-ellipsis" href="{{$run.RefLink}}" data-tooltip-content="{{$run.RefTooltip}}">{{$run.PrettyRef}}</a>
 | 
				
			||||||
				{{end}}
 | 
									{{end}}
 | 
				
			||||||
				<div class="run-list-item-right">
 | 
									<div class="run-list-item-right">
 | 
				
			||||||
					<div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince $run.Updated}}</div>
 | 
										<div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince $run.Updated}}</div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user