review: applied some review changes

This commit is contained in:
Wyatt Johnson
2018-09-21 15:29:34 -06:00
parent ce1002b16c
commit daee96dc4c
5 changed files with 20 additions and 16 deletions
@@ -9,7 +9,7 @@ import {
} from "talk-server/graph/tenant/schema/__generated__/types";
import {
ACTION_ITEM_TYPE,
retrieveManyAuthoredActionPresence,
retrieveManyUserActionPresence,
} from "talk-server/models/actions";
import {
retrieveCommentAssetConnection,
@@ -21,9 +21,9 @@ export default (ctx: Context) => ({
comment: new DataLoader((ids: string[]) =>
retrieveManyComments(ctx.mongo, ctx.tenant.id, ids)
),
retrieveAuthoredActionPresence: new DataLoader<string, GQLActionPresence>(
retrieveMyActionPresence: new DataLoader<string, GQLActionPresence>(
(itemIDs: string[]) =>
retrieveManyAuthoredActionPresence(
retrieveManyUserActionPresence(
ctx.mongo,
ctx.tenant.id,
// This should only ever be accessed when a user is logged in.
@@ -19,8 +19,10 @@ const Comment: GQLCommentTypeResolver<Comment> = {
replies: (comment, input, ctx) =>
ctx.loaders.Comments.forParent(comment.asset_id, comment.id, input),
actionCounts: comment => decodeActionCounts(comment.action_counts),
authoredActionPresence: (comment, input, ctx) =>
ctx.loaders.Comments.retrieveAuthoredActionPresence.load(comment.id),
myActionPresence: (comment, input, ctx) =>
ctx.user
? ctx.loaders.Comments.retrieveMyActionPresence.load(comment.id)
: null,
};
export default Comment;
@@ -833,10 +833,10 @@ type Comment {
actionCounts: ActionCounts!
"""
authoredActionPresence stores the presense information for all the actions
myActionPresence stores the presense information for all the actions
left by the current User on this Comment.
"""
authoredActionPresence: ActionPresence! @auth
myActionPresence: ActionPresence
}
type PageInfo {