()
| 215 | } |
| 216 | |
| 217 | func (s *StatusGetter) CurrentUsername() (string, error) { |
| 218 | s.usernameMu.Lock() |
| 219 | defer s.usernameMu.Unlock() |
| 220 | |
| 221 | if s.currentUsername != "" { |
| 222 | return s.currentUsername, nil |
| 223 | } |
| 224 | |
| 225 | cachedClient := s.CachedClient(time.Hour * 48) |
| 226 | cachingAPIClient := api.NewClientFromHTTP(cachedClient) |
| 227 | currentUsername, err := api.CurrentLoginName(cachingAPIClient, s.hostname()) |
| 228 | if err != nil { |
| 229 | return "", fmt.Errorf("failed to get current username: %w", err) |
| 230 | } |
| 231 | |
| 232 | s.currentUsername = currentUsername |
| 233 | return currentUsername, nil |
| 234 | } |
| 235 | |
| 236 | func (s *StatusGetter) ActualMention(commentURL string) (string, error) { |
| 237 | currentUsername, err := s.CurrentUsername() |
no test coverage detected