Create additional labels when detecting Dendrite or Conduit homeservers in the rageshake body
This commit is contained in:
parent
85b721070a
commit
3b47a279ca
1 changed files with 33 additions and 21 deletions
24
submit.go
24
submit.go
|
@ -695,14 +695,30 @@ func buildGenericIssueRequest(p payload, listingURL string) (title, body string)
|
||||||
return
|
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 {
|
func buildGithubIssueRequest(p payload, listingURL string) github.IssueRequest {
|
||||||
title, body := buildGenericIssueRequest(p, listingURL)
|
title, body := buildGenericIssueRequest(p, listingURL)
|
||||||
|
|
||||||
labels := p.Labels
|
labels := append(p.Labels, getAdditionalLabels(p)...)
|
||||||
// go-github doesn't like nils
|
// go-github doesn't like nils
|
||||||
if labels == nil {
|
if labels == nil {
|
||||||
labels = []string{}
|
labels = []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return github.IssueRequest{
|
return github.IssueRequest{
|
||||||
Title: &title,
|
Title: &title,
|
||||||
Body: &body,
|
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 {
|
func buildGitlabIssueRequest(p payload, listingURL string, labels []string, confidential bool) *gitlab.CreateIssueOptions {
|
||||||
title, body := buildGenericIssueRequest(p, listingURL)
|
title, body := buildGenericIssueRequest(p, listingURL)
|
||||||
|
|
||||||
if p.Labels != nil {
|
|
||||||
labels = append(labels, p.Labels...)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &gitlab.CreateIssueOptions{
|
return &gitlab.CreateIssueOptions{
|
||||||
Title: &title,
|
Title: &title,
|
||||||
Description: &body,
|
Description: &body,
|
||||||
Confidential: &confidential,
|
Confidential: &confidential,
|
||||||
Labels: labels,
|
Labels: append(p.Labels, getAdditionalLabels(p)...),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue