mirror of
https://github.com/wassname/talk.git
synced 2026-07-03 12:54:43 +08:00
review: applied some review changes
This commit is contained in:
Generated
+7
-5
@@ -10222,11 +10222,8 @@
|
||||
"resolved": "https://registry.npmjs.org/fluent-intl-polyfill/-/fluent-intl-polyfill-0.1.0.tgz",
|
||||
"integrity": "sha1-ETOUSrJHeINHOZVZaIPg05z4hc8=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"intl-pluralrules": {
|
||||
"version": "github:projectfluent/IntlPluralRules#94cb0fa1c23ad943bc5aafef43cea132fa51d68b",
|
||||
"from": "github:projectfluent/IntlPluralRules#94cb0fa1c23ad943bc5aafef43cea132fa51d68b"
|
||||
}
|
||||
"requires": {
|
||||
"intl-pluralrules": "github:projectfluent/IntlPluralRules#94cb0fa1c23ad943bc5aafef43cea132fa51d68b"
|
||||
}
|
||||
},
|
||||
"fluent-langneg": {
|
||||
@@ -12670,6 +12667,11 @@
|
||||
"integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=",
|
||||
"dev": true
|
||||
},
|
||||
"intl-pluralrules": {
|
||||
"version": "github:projectfluent/IntlPluralRules#94cb0fa1c23ad943bc5aafef43cea132fa51d68b",
|
||||
"from": "github:projectfluent/IntlPluralRules#module",
|
||||
"dev": true
|
||||
},
|
||||
"invariant": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Joi from "joi";
|
||||
import { pick } from "lodash";
|
||||
import { camelCase, pick } from "lodash";
|
||||
import { Db } from "mongodb";
|
||||
import uuid from "uuid";
|
||||
|
||||
@@ -190,10 +190,10 @@ export async function createActions(
|
||||
}
|
||||
|
||||
/**
|
||||
* retrieveManyAuthoredActionPresence returns the action presence for a specific
|
||||
* retrieveManyUserActionPresence returns the action presence for a specific
|
||||
* user.
|
||||
*/
|
||||
export async function retrieveManyAuthoredActionPresence(
|
||||
export async function retrieveManyUserActionPresence(
|
||||
mongo: Db,
|
||||
tenantID: string,
|
||||
userID: string | null,
|
||||
@@ -226,7 +226,7 @@ export async function retrieveManyAuthoredActionPresence(
|
||||
itemActions.reduce(
|
||||
(actionPresence, { action_type }) => ({
|
||||
...actionPresence,
|
||||
[action_type.toLowerCase()]: true,
|
||||
[camelCase(action_type)]: true,
|
||||
}),
|
||||
{
|
||||
reaction: false,
|
||||
|
||||
Reference in New Issue
Block a user