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

Method ActualMention

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

Source from the content-addressed store, hash-verified

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