mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	more fixes on #2045
This commit is contained in:
		| @@ -83,19 +83,19 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e | |||||||
| 	// n new commits | 	// n new commits | ||||||
| 	var ( | 	var ( | ||||||
| 		branchName   = git.RefEndName(p.Ref) | 		branchName   = git.RefEndName(p.Ref) | ||||||
|  | 		commitDesc   string | ||||||
| 		commitString string | 		commitString string | ||||||
| 	) | 	) | ||||||
|  |  | ||||||
| 	if len(p.Commits) == 1 { | 	if len(p.Commits) == 1 { | ||||||
| 		commitString = "1 new commit" | 		commitDesc = "1 new commit" | ||||||
| 		if len(p.CompareUrl) > 0 { |  | ||||||
| 			commitString = SlackLinkFormatter(p.CompareUrl, commitString) |  | ||||||
| 		} |  | ||||||
| 	} else { | 	} else { | ||||||
| 		commitString = fmt.Sprintf("%d new commits", len(p.Commits)) | 		commitDesc = fmt.Sprintf("%d new commits", len(p.Commits)) | ||||||
| 		if p.CompareUrl != "" { | 	} | ||||||
| 			commitString = SlackLinkFormatter(p.CompareUrl, commitString) | 	if len(p.CompareUrl) > 0 { | ||||||
| 		} | 		commitString = SlackLinkFormatter(p.CompareUrl, commitDesc) | ||||||
|  | 	} else { | ||||||
|  | 		commitString = commitDesc | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	repoLink := SlackLinkFormatter(p.Repo.URL, p.Repo.Name) | 	repoLink := SlackLinkFormatter(p.Repo.URL, p.Repo.Name) | ||||||
| @@ -114,7 +114,7 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e | |||||||
|  |  | ||||||
| 	slackAttachments := []SlackAttachment{{ | 	slackAttachments := []SlackAttachment{{ | ||||||
| 		Fallback: fmt.Sprintf("%s pushed %s to %s/%s: %s", | 		Fallback: fmt.Sprintf("%s pushed %s to %s/%s: %s", | ||||||
| 			p.Pusher, commitString, p.Repo.Name, branchName, p.CompareUrl), | 			p.Pusher, commitDesc, p.Repo.Name, branchName, p.CompareUrl), | ||||||
| 		Color: slack.Color, | 		Color: slack.Color, | ||||||
| 		Text:  attachmentText, | 		Text:  attachmentText, | ||||||
| 	}} | 	}} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user