(commentURL safeurl.SafeURL)
| 231 | } |
| 232 | |
| 233 | func (s *StatusGetter) ActualMention(commentURL safeurl.SafeURL) (string, error) { |
| 234 | currentUsername, err := s.CurrentUsername() |
| 235 | if err != nil { |
| 236 | return "", err |
| 237 | } |
| 238 | |
| 239 | // long cache period since once a comment is looked up, it never needs to be |
| 240 | // consulted again. |
| 241 | cachedClient := s.CachedClient(time.Hour * 24 * 30) |
| 242 | c := api.NewClientFromHTTP(cachedClient) |
| 243 | resp := struct { |
| 244 | Body string |
| 245 | }{} |
| 246 | if err := c.REST(s.hostname(), "GET", commentURL.String(), nil, &resp); err != nil { |
| 247 | return "", err |
| 248 | } |
| 249 | |
| 250 | if strings.Contains(resp.Body, "@"+currentUsername) { |
| 251 | return resp.Body, nil |
| 252 | } |
| 253 | |
| 254 | return "", nil |
| 255 | } |
| 256 | |
| 257 | // These are split up by endpoint since it is along that boundary we parallelize |
| 258 | // work |
no test coverage detected