MCPcopy Index your code
hub / github.com/the-open-agent/openagent / resolveIssueCommentTarget

Function resolveIssueCommentTarget

controllers/comment.go:250–277  ·  view source on GitHub ↗

resolveIssueCommentTarget validates that the issue exists and resolves the owner allowed to moderate its comments (the issue's store owner).

(targetKey string)

Source from the content-addressed store, hash-verified

248// resolveIssueCommentTarget validates that the issue exists and resolves the
249// owner allowed to moderate its comments (the issue's store owner).
250func 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

Callers 1

resolveCommentTargetFunction · 0.85

Calls 4

GetIssueFunction · 0.92
GetStoreFunction · 0.92
GetIdFromOwnerAndNameFunction · 0.92

Tested by

no test coverage detected