mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	Backport #27839 by @lunny Fix #23742 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
		| @@ -210,6 +210,21 @@ func (m *MatrixPayload) Repository(p *api.RepositoryPayload) (api.Payloader, err | ||||
| 	return getMatrixPayload(text, nil, m.MsgType), nil | ||||
| } | ||||
|  | ||||
| func (m *MatrixPayload) Package(p *api.PackagePayload) (api.Payloader, error) { | ||||
| 	senderLink := MatrixLinkFormatter(setting.AppURL+p.Sender.UserName, p.Sender.UserName) | ||||
| 	repoLink := MatrixLinkFormatter(p.Repository.HTMLURL, p.Repository.FullName) | ||||
| 	var text string | ||||
|  | ||||
| 	switch p.Action { | ||||
| 	case api.HookPackageCreated: | ||||
| 		text = fmt.Sprintf("[%s] Package published by %s", repoLink, senderLink) | ||||
| 	case api.HookPackageDeleted: | ||||
| 		text = fmt.Sprintf("[%s] Package deleted by %s", repoLink, senderLink) | ||||
| 	} | ||||
|  | ||||
| 	return getMatrixPayload(text, nil, m.MsgType), nil | ||||
| } | ||||
|  | ||||
| // GetMatrixPayload converts a Matrix webhook into a MatrixPayload | ||||
| func GetMatrixPayload(p api.Payloader, event webhook_module.HookEventType, meta string) (api.Payloader, error) { | ||||
| 	s := new(MatrixPayload) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user