api: fix SupersededBy
This commit is contained in:
parent
eed9fe1752
commit
72c9a57a73
|
@ -56,7 +56,13 @@ func (r *commentResolver) Authenticity(ctx context.Context, obj *model.Comment)
|
|||
}
|
||||
|
||||
func (r *commentResolver) SupersededBy(ctx context.Context, obj *model.Comment) (*model.Comment, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
if obj.Database.SuperceededByID == nil {
|
||||
return nil, nil
|
||||
}
|
||||
// The only route to this resolver is via event details, which is already
|
||||
// authenticated. Further access to other resources is limited to
|
||||
// authenticated routes, such as TicketByID.
|
||||
return loaders.ForContext(ctx).CommentsByIDUnsafe.Load(*obj.Database.SuperceededByID)
|
||||
}
|
||||
|
||||
func (r *createdResolver) Ticket(ctx context.Context, obj *model.Created) (*model.Ticket, error) {
|
||||
|
@ -617,19 +623,3 @@ type trackerACLResolver struct{ *Resolver }
|
|||
type trackerSubscriptionResolver struct{ *Resolver }
|
||||
type userResolver struct{ *Resolver }
|
||||
type userMentionResolver struct{ *Resolver }
|
||||
|
||||
// !!! WARNING !!!
|
||||
// The code below was going to be deleted when updating resolvers. It has been copied here so you have
|
||||
// one last chance to move it out of harms way if you want. There are two reasons this happens:
|
||||
// - When renaming or deleting a resolver the old code will be put in here. You can safely delete
|
||||
// it when you're done.
|
||||
// - You have helper methods in this file. Move them out to keep these resolver files clean.
|
||||
func (r *commentResolver) SuperceededBy(ctx context.Context, obj *model.Comment) (*model.Comment, error) {
|
||||
if obj.Database.SuperceededByID == nil {
|
||||
return nil, nil
|
||||
}
|
||||
// The only route to this resolver is via event details, which is already
|
||||
// authenticated. Further access to other resources is limited to
|
||||
// authenticated routes, such as TicketByID.
|
||||
return loaders.ForContext(ctx).CommentsByIDUnsafe.Load(*obj.Database.SuperceededByID)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue