-
-
+
+
+ Isabelle
+
+
({
first = 10,
orderBy = GQLCOMMENT_SORT.CREATED_AT_DESC,
after,
- }: StoryToCommentsArgs
+ }: UserToCommentsArgs
) =>
retrieveCommentUserConnection(ctx.mongo, ctx.tenant.id, userID, {
first,
orderBy,
after,
}).then(primeCommentsFromConnection(ctx)),
+ forUserAll: (
+ userID: string,
+ // Apply the graph schema defaults at the loader.
+ { first = 10, after }: UserToAllCommentsArgs
+ ) =>
+ retrieveAllCommentsUserConnection(ctx.mongo, ctx.tenant.id, userID, {
+ first,
+ orderBy: GQLCOMMENT_SORT.CREATED_AT_DESC,
+ after,
+ }).then(primeCommentsFromConnection(ctx)),
+ forUserRejected: (
+ userID: string,
+ // Apply the graph schema defaults at the loader.
+ { first = 10, after }: UserToRejectedCommentsArgs
+ ) =>
+ retrieveRejectedCommentUserConnection(ctx.mongo, ctx.tenant.id, userID, {
+ first,
+ orderBy: GQLCOMMENT_SORT.CREATED_AT_DESC,
+ after,
+ }).then(primeCommentsFromConnection(ctx)),
taggedForStory: (
storyID: string,
tag: GQLTAG,
diff --git a/src/core/server/graph/tenant/resolvers/User.ts b/src/core/server/graph/tenant/resolvers/User.ts
index 7db2cbba2..cf67255fd 100644
--- a/src/core/server/graph/tenant/resolvers/User.ts
+++ b/src/core/server/graph/tenant/resolvers/User.ts
@@ -34,6 +34,10 @@ const maybeLoadOnlyIgnoredUserID = (
export const User: GQLUserTypeResolver = {
comments: ({ id }, input, ctx) => ctx.loaders.Comments.forUser(id, input),
+ allComments: ({ id }, input, ctx) =>
+ ctx.loaders.Comments.forUserAll(id, input),
+ rejectedComments: ({ id }, input, ctx) =>
+ ctx.loaders.Comments.forUserRejected(id, input),
commentModerationActionHistory: ({ id }, input, ctx) =>
ctx.loaders.CommentModerationActions.forModerator(input, id),
status: ({ id, status }): UserStatusInput => ({
diff --git a/src/core/server/graph/tenant/schema/schema.graphql b/src/core/server/graph/tenant/schema/schema.graphql
index 33296d57e..d6049c6dc 100644
--- a/src/core/server/graph/tenant/schema/schema.graphql
+++ b/src/core/server/graph/tenant/schema/schema.graphql
@@ -1521,6 +1521,18 @@ type User {
permit: [SUSPENDED, BANNED]
)
+ """
+ allComments are comments regardless of visibility status.
+ """
+ allComments(first: Int = 10, after: Cursor): CommentsConnection!
+ @auth(roles: [ADMIN, MODERATOR])
+
+ """
+ rejectedComments are comments that have been rejected.
+ """
+ rejectedComments(first: Int = 10, after: Cursor): CommentsConnection!
+ @auth(roles: [ADMIN, MODERATOR])
+
"""
commentModerationActionHistory returns a CommentModerationActionConnection
that this User has created.
diff --git a/src/core/server/models/comment/index.ts b/src/core/server/models/comment/index.ts
index 8d7b6b8e0..09bfe6060 100644
--- a/src/core/server/models/comment/index.ts
+++ b/src/core/server/models/comment/index.ts
@@ -657,6 +657,57 @@ export const retrieveCommentUserConnection = (
},
});
+/**
+ * retrieveAllCommentUserConnection returns a Connection for a given User's
+ * comments regardless of comment status.
+ *
+ * @param mongo database connection
+ * @param tenantID the Tenant's ID
+ * @param userID the User id for the comment to retrieve
+ * @param input connection configuration
+ */
+export const retrieveAllCommentsUserConnection = (
+ mongo: Db,
+ tenantID: string,
+ userID: string,
+ input: CommentConnectionInput
+) =>
+ retrieveCommentConnection(mongo, tenantID, {
+ ...input,
+ filter: {
+ ...input.filter,
+ authorID: userID,
+ },
+ });
+
+/**
+ * retrieveRejectedCommentUserConnection returns a Connection for a given User's
+ * rejected comments.
+ *
+ * @param mongo database connection
+ * @param tenantID the Tenant's ID
+ * @param userID the User id for the comment to retrieve
+ * @param input connection configuration
+ */
+export const retrieveRejectedCommentUserConnection = (
+ mongo: Db,
+ tenantID: string,
+ userID: string,
+ input: CommentConnectionInput
+) =>
+ retrieveStatusCommentConnection(
+ mongo,
+ tenantID,
+ [GQLCOMMENT_STATUS.REJECTED],
+ {
+ ...input,
+ filter: {
+ ...input.filter,
+ authorID: userID,
+ },
+ }
+ );
+
/**
* retrieveVisibleCommentConnection will retrieve a connection that contains
* comments that are visible.
diff --git a/src/locales/en-US/admin.ftl b/src/locales/en-US/admin.ftl
index 2b10007bf..7eb2858d9 100644
--- a/src/locales/en-US/admin.ftl
+++ b/src/locales/en-US/admin.ftl
@@ -388,6 +388,15 @@ moderate-searchBar-comboBoxTextField =
moderate-searchBar-goTo = Go to
moderate-searchBar-seeAllResults = See all results
+### Moderate User History Drawer
+
+moderate-user-drawer-tab-all-comments = All Comments
+moderate-user-drawer-tab-rejected-comments = Rejected
+moderate-user-drawer-load-more = Load More
+moderate-user-drawer-all-no-comments = {$username} has not submitted any comments.
+moderate-user-drawer-rejected-no-comments = {$username} does not have any rejected comments.
+moderate-user-drawer-user-not-found = User not found.
+
## Create Username
createUsername-createUsernameHeader = Create Username