MCPcopy Create free account
hub / github.com/cli/cli / ActualMention

Method ActualMention

pkg/cmd/status/status.go:233–255  ·  view source on GitHub ↗
(commentURL safeurl.SafeURL)

Source from the content-addressed store, hash-verified

231}
232
233func (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

Callers 1

LoadNotificationsMethod · 0.95

Calls 6

CurrentUsernameMethod · 0.95
CachedClientMethod · 0.95
hostnameMethod · 0.95
ContainsMethod · 0.80
RESTMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected