resolveIssueCommentTarget validates that the issue exists and resolves the owner allowed to moderate its comments (the issue's store owner).
(targetKey string)
| 248 | // resolveIssueCommentTarget validates that the issue exists and resolves the |
| 249 | // owner allowed to moderate its comments (the issue's store owner). |
| 250 | func resolveIssueCommentTarget(targetKey string) (*commentTarget, error) { |
| 251 | owner, name, err := util.GetOwnerAndNameFromIdWithError(targetKey) |
| 252 | if err != nil { |
| 253 | return nil, err |
| 254 | } |
| 255 | |
| 256 | issue, err := object.GetIssue(owner, name) |
| 257 | if err != nil { |
| 258 | return nil, err |
| 259 | } |
| 260 | if issue == nil { |
| 261 | return nil, fmt.Errorf("Comment target does not exist") |
| 262 | } |
| 263 | |
| 264 | storeOwner, storeName, err := util.GetOwnerAndNameFromIdWithError(issue.Store) |
| 265 | if err != nil { |
| 266 | return nil, err |
| 267 | } |
| 268 | store, err := object.GetStore(util.GetIdFromOwnerAndName(storeOwner, storeName)) |
| 269 | if err != nil { |
| 270 | return nil, err |
| 271 | } |
| 272 | if store == nil { |
| 273 | return nil, fmt.Errorf("Comment target does not exist") |
| 274 | } |
| 275 | |
| 276 | return &commentTarget{Owner: store.Owner}, nil |
| 277 | } |
| 278 | |
| 279 | // GetGlobalComments |
| 280 | // @Title GetGlobalComments |
no test coverage detected