Skip to content

Commit

Permalink
Add admin link to linear
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Jun 5, 2024
1 parent f86d649 commit 5adcff4
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,14 +905,7 @@ func (s *submitServer) submitWebhook(ctx context.Context, p parsedPayload, listi
return err
}

func buildReportTitle(p parsedPayload) string {
// set the title to the first (non-empty) line of the user's report, if any
trimmedUserText := strings.TrimSpace(p.UserText)
if trimmedUserText == "" {
trimmedUserText = "Untitled report"
} else if i := strings.IndexAny(trimmedUserText, "\r\n"); i >= 0 {
trimmedUserText = trimmedUserText[0:i]
}
func getUsernameFromPayload(p parsedPayload) string {
userID := p.Data["user_id"]
if len(userID) == 0 {
userID = p.Data["unverified_user_id"]
Expand All @@ -922,7 +915,17 @@ func buildReportTitle(p parsedPayload) string {
userID = fmt.Sprintf("[unverified] %s", userID)
}
}
userID = strings.TrimPrefix(strings.TrimSuffix(userID, ":beeper.com"), "@")
return strings.TrimPrefix(strings.TrimSuffix(userID, ":beeper.com"), "@")
}

func buildReportTitle(userID string, p parsedPayload) string {
// set the title to the first (non-empty) line of the user's report, if any
trimmedUserText := strings.TrimSpace(p.UserText)
if trimmedUserText == "" {
trimmedUserText = "Untitled report"
} else if i := strings.IndexAny(trimmedUserText, "\r\n"); i >= 0 {
trimmedUserText = trimmedUserText[0:i]
}
title := fmt.Sprintf("%s: %s", userID, trimmedUserText)
if len(title) > 200 {
title = title[:200]
Expand Down Expand Up @@ -1022,10 +1025,12 @@ func printDataKeys(p parsedPayload, output io.Writer, title string, keys []strin
func (s *submitServer) buildGenericIssueRequest(ctx context.Context, p parsedPayload, listingURL string) (title, body string) {
bodyBuf := s.buildReportBody(ctx, p, listingURL)

username := getUsernameFromPayload(p)

// Add log links to the body
fmt.Fprintf(bodyBuf, "\n### [Logs](%s)", listingURL)
fmt.Fprintf(bodyBuf, "\n### [Rageshake Logs](%s) | [User Admin](https://admin.beeper.com/user/%s)", listingURL, username)

title = buildReportTitle(p)
title = buildReportTitle(username, p)

body = bodyBuf.String()

Expand Down

0 comments on commit 5adcff4

Please sign in to comment.