| 120 | } |
| 121 | |
| 122 | func (a *Approver) createSentryEvent() { |
| 123 | var appData map[string]interface{} |
| 124 | err := json.Unmarshal(a.application.GetData(), &appData) |
| 125 | if err != nil { |
| 126 | sentry.CaptureException(err) |
| 127 | log.Fatal(err) |
| 128 | } |
| 129 | |
| 130 | var applicationType string |
| 131 | if a.application.Project.IsTeam { |
| 132 | applicationType = "team" |
| 133 | } else if a.application.Project.IsEvent { |
| 134 | applicationType = "event" |
| 135 | } else { |
| 136 | applicationType = "project" |
| 137 | } |
| 138 | |
| 139 | tags := map[string]string{ |
| 140 | "project_name": a.application.Project.Name, |
| 141 | "homepage_url": a.application.Project.HomeURL, |
| 142 | "application_type": applicationType, |
| 143 | "team_size": strconv.Itoa(a.application.Project.Contributors), |
| 144 | "issue_number": strconv.Itoa(a.application.IssueNumber), |
| 145 | "approved_by": fmt.Sprintf("@%s", a.application.ApproverUsername), |
| 146 | "can_contact": strconv.FormatBool(a.application.CanContact), |
| 147 | } |
| 148 | |
| 149 | sentry.CaptureEvent(&sentry.Event{ |
| 150 | Message: fmt.Sprintf("Application approved for \"%s\"", a.application.Project.Name), |
| 151 | Level: sentry.LevelInfo, |
| 152 | Extra: appData, |
| 153 | Tags: tags, |
| 154 | }) |
| 155 | } |