Compare commits

...
This repository has been archived on 2022-08-18. You can view files and clone it, but cannot push or open issues or pull requests.

2 Commits

Author SHA1 Message Date
Neil Alexander 1f497d857f
Add news 2022-04-25 15:20:23 +01:00
Neil Alexander 3b47a279ca
Create additional labels when detecting Dendrite or Conduit homeservers in the rageshake body 2022-04-25 15:15:52 +01:00
2 changed files with 34 additions and 21 deletions

1
changelog.d/55.feature Normal file
View File

@ -0,0 +1 @@
Add Dendrite and Conduit labels when detected in the `server_version` field of the rageshake payload

View File

@ -695,14 +695,30 @@ func buildGenericIssueRequest(p payload, listingURL string) (title, body string)
return
}
func getAdditionalLabels(p payload) []string {
labels := []string{}
if serverVersion, ok := p.Data["server_version"]; ok {
// TODO: It seems only Element Android sends server_version right now and
// that Element iOS doesn't, so we should do something about that.
switch {
case strings.Contains(serverVersion, "Dendrite"):
labels = append(labels, "Dendrite")
case strings.Contains(serverVersion, "Conduit"):
labels = append(labels, "Conduit")
}
}
return labels
}
func buildGithubIssueRequest(p payload, listingURL string) github.IssueRequest {
title, body := buildGenericIssueRequest(p, listingURL)
labels := p.Labels
labels := append(p.Labels, getAdditionalLabels(p)...)
// go-github doesn't like nils
if labels == nil {
labels = []string{}
}
return github.IssueRequest{
Title: &title,
Body: &body,
@ -713,15 +729,11 @@ func buildGithubIssueRequest(p payload, listingURL string) github.IssueRequest {
func buildGitlabIssueRequest(p payload, listingURL string, labels []string, confidential bool) *gitlab.CreateIssueOptions {
title, body := buildGenericIssueRequest(p, listingURL)
if p.Labels != nil {
labels = append(labels, p.Labels...)
}
return &gitlab.CreateIssueOptions{
Title: &title,
Description: &body,
Confidential: &confidential,
Labels: labels,
Labels: append(p.Labels, getAdditionalLabels(p)...),
}
}