FilterCommentEvents returns only the comment events specified by the identifiers If identifiers is nil or empty, returns all comment events
(identifiers []string)
| 101 | // FilterCommentEvents returns only the comment events specified by the identifiers |
| 102 | // If identifiers is nil or empty, returns all comment events |
| 103 | func FilterCommentEvents(identifiers []string) []CommentEventMapping { |
| 104 | // len() for nil slices returns 0, so this handles both nil and empty slices |
| 105 | if len(identifiers) == 0 { |
| 106 | commentLog.Print("Filtering comment events: no identifiers specified, returning all events") |
| 107 | return GetAllCommentEvents() |
| 108 | } |
| 109 | |
| 110 | commentLog.Printf("Filtering comment events: %d identifiers specified", len(identifiers)) |
| 111 | var result []CommentEventMapping |
| 112 | for _, identifier := range identifiers { |
| 113 | if mapping := GetCommentEventByIdentifier(identifier); mapping != nil { |
| 114 | result = append(result, *mapping) |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | return result |
| 119 | } |
| 120 | |
| 121 | // GetCommentEventNames returns just the event names from a list of mappings |
| 122 | func GetCommentEventNames(mappings []CommentEventMapping) []string { |