mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
initial pagination rewrite, cleanups to comment edit
This commit is contained in:
+14
-17
@@ -25,34 +25,31 @@ const genAssetsByID = (context, ids) => AssetModel.find({
|
||||
* @param {String} asset_url the url passed in from the query
|
||||
* @returns {Promise} resolves to the asset
|
||||
*/
|
||||
const findOrCreateAssetByURL = (context, asset_url) => {
|
||||
const findOrCreateAssetByURL = async (context, asset_url) => {
|
||||
|
||||
// Verify that the asset_url is parsable.
|
||||
let parsed_asset_url = url.parse(asset_url);
|
||||
if (!parsed_asset_url.protocol) {
|
||||
return Promise.reject(errors.ErrInvalidAssetURL);
|
||||
throw errors.ErrInvalidAssetURL;
|
||||
}
|
||||
|
||||
return AssetsService.findOrCreateByUrl(asset_url)
|
||||
.then((asset) => {
|
||||
let asset = await AssetsService.findOrCreateByUrl(asset_url);
|
||||
|
||||
// If the asset wasn't scraped before, scrape it! Otherwise just return
|
||||
// the asset.
|
||||
if (!asset.scraped) {
|
||||
return scraper.create(asset).then(() => asset);
|
||||
}
|
||||
// If the asset wasn't scraped before, scrape it! Otherwise just return
|
||||
// the asset.
|
||||
if (!asset.scraped) {
|
||||
await scraper.create(asset);
|
||||
}
|
||||
|
||||
return asset;
|
||||
});
|
||||
return asset;
|
||||
};
|
||||
|
||||
const getAssetsForMetrics = ({loaders: {Actions, Comments}}) => {
|
||||
return Actions.getByTypes({action_type: 'FLAG', item_type: 'COMMENT'})
|
||||
.then((actions) => { // ALL ACTIONS :O
|
||||
const ids = actions.map(({item_id}) => item_id);
|
||||
const getAssetsForMetrics = async ({loaders: {Actions, Comments}}) => {
|
||||
let actions = await Actions.getByTypes({action_type: 'FLAG', item_type: 'COMMENT'});
|
||||
|
||||
return Comments.getByQuery({ids});
|
||||
});
|
||||
const ids = actions.map(({item_id}) => item_id);
|
||||
|
||||
return Comments.getByQuery({ids});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -120,8 +120,8 @@ const getParentCountByAssetIDPersonalized = async (context, {assetId, excludeIgn
|
||||
const ignoredUsers = freshUser.ignoresUsers;
|
||||
query.author_id = {$nin: ignoredUsers};
|
||||
}
|
||||
const count = await CommentModel.where(query).count();
|
||||
return count;
|
||||
|
||||
return CommentModel.where(query).count();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -263,13 +263,9 @@ const getCommentsByQuery = async ({user}, {ids, statuses, asset_id, parent_id, a
|
||||
comments = comments.where({parent_id});
|
||||
}
|
||||
|
||||
if (excludeIgnored && user) {
|
||||
|
||||
// load afresh, as `user` may be from cache and not have recent ignores
|
||||
const freshUser = await UsersService.findById(user.id);
|
||||
const ignoredUsers = freshUser.ignoresUsers;
|
||||
if (excludeIgnored && user && user.ignoresUsers) {
|
||||
comments = comments.where({
|
||||
author_id: {$nin: ignoredUsers}
|
||||
author_id: {$nin: user.ignoresUsers}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -294,6 +290,27 @@ const getCommentsByQuery = async ({user}, {ids, statuses, asset_id, parent_id, a
|
||||
.limit(limit);
|
||||
};
|
||||
|
||||
const getCommentsConnection = async ({user}, query) => {
|
||||
let {limit} = query;
|
||||
|
||||
// Increate the limit by one.
|
||||
query.limit++;
|
||||
|
||||
let comments = await getCommentsByQuery({user}, query);
|
||||
|
||||
if (!comments) {
|
||||
comments = [];
|
||||
}
|
||||
|
||||
return {
|
||||
edges: comments.slice(0, limit),
|
||||
pageInfo: {
|
||||
hasNextPage: Boolean(comments.length > limit),
|
||||
cursor: comments.length > 0 ? comments[comments.length - 1].created_at : null
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the recent replies.
|
||||
* @param {Object} context graph context
|
||||
@@ -431,6 +448,7 @@ module.exports = (context) => ({
|
||||
Comments: {
|
||||
get: new DataLoader((ids) => genComments(context, ids)),
|
||||
getByQuery: (query) => getCommentsByQuery(context, query),
|
||||
getConnection: (query) => getCommentsConnection(context, query),
|
||||
getCountByQuery: (query) => getCommentCountByQuery(context, query),
|
||||
countByAssetID: new SharedCounterDataLoader('Comments.totalCommentCount', 3600, (ids) => getCountsByAssetID(context, ids)),
|
||||
countByAssetIDPersonalized: (query) => getCountsByAssetIDPersonalized(context, query),
|
||||
|
||||
+10
-10
@@ -12,23 +12,23 @@ const errors = require('../../errors');
|
||||
* @param {String} action_type type of the action
|
||||
* @return {Promise} resolves to the action created
|
||||
*/
|
||||
const createAction = ({user = {}}, {item_id, item_type, action_type, group_id, metadata = {}}) => {
|
||||
return ActionsService.insertUserAction({
|
||||
const createAction = async ({user = {}}, {item_id, item_type, action_type, group_id, metadata = {}}) => {
|
||||
let action = await ActionsService.insertUserAction({
|
||||
item_id,
|
||||
item_type,
|
||||
user_id: user.id,
|
||||
group_id,
|
||||
action_type,
|
||||
metadata
|
||||
}).then((action) => {
|
||||
if (item_type === 'USERS' && action_type === 'FLAG') {
|
||||
return UsersService
|
||||
.setStatus(item_id, 'PENDING')
|
||||
.then(() => action);
|
||||
}
|
||||
|
||||
return action;
|
||||
});
|
||||
|
||||
if (item_type === 'USERS' && action_type === 'FLAG') {
|
||||
|
||||
// Set the user as pending if it was a user flag.
|
||||
await UsersService.setStatus(item_id, 'PENDING');
|
||||
}
|
||||
|
||||
return action;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+101
-132
@@ -16,7 +16,7 @@ const Wordlist = require('../../services/wordlist');
|
||||
* @param {String} [status='NONE'] the status of the new comment
|
||||
* @return {Promise} resolves to the created comment
|
||||
*/
|
||||
const createComment = ({user, loaders: {Comments}, pubsub}, {body, asset_id, parent_id = null, tags = []}, status = 'NONE') => {
|
||||
const createComment = async ({user, loaders: {Comments}, pubsub}, {body, asset_id, parent_id = null, tags = []}, status = 'NONE') => {
|
||||
|
||||
// Building array of tags
|
||||
tags = tags.map(tag => ({name: tag}));
|
||||
@@ -26,37 +26,35 @@ const createComment = ({user, loaders: {Comments}, pubsub}, {body, asset_id, par
|
||||
tags.push({name: 'STAFF'});
|
||||
}
|
||||
|
||||
return CommentsService.publicCreate({
|
||||
let comment = await CommentsService.publicCreate({
|
||||
body,
|
||||
asset_id,
|
||||
parent_id,
|
||||
status,
|
||||
tags,
|
||||
author_id: user.id
|
||||
})
|
||||
.then((comment) => {
|
||||
|
||||
// If the loaders are present, clear the caches for these values because we
|
||||
// just added a new comment, hence the counts should be updated. We should
|
||||
// perform these increments in the event that we do have a new comment that
|
||||
// is approved or without a comment.
|
||||
if (status === 'NONE' || status === 'APPROVED') {
|
||||
if (parent_id != null) {
|
||||
Comments.countByParentID.incr(parent_id);
|
||||
} else {
|
||||
Comments.parentCountByAssetID.incr(asset_id);
|
||||
}
|
||||
Comments.countByAssetID.incr(asset_id);
|
||||
|
||||
if (pubsub) {
|
||||
|
||||
// Publish the newly added comment via the subscription.
|
||||
pubsub.publish('commentAdded', comment);
|
||||
}
|
||||
}
|
||||
|
||||
return comment;
|
||||
});
|
||||
|
||||
// If the loaders are present, clear the caches for these values because we
|
||||
// just added a new comment, hence the counts should be updated. We should
|
||||
// perform these increments in the event that we do have a new comment that
|
||||
// is approved or without a comment.
|
||||
if (status === 'NONE' || status === 'APPROVED') {
|
||||
if (parent_id != null) {
|
||||
Comments.countByParentID.incr(parent_id);
|
||||
} else {
|
||||
Comments.parentCountByAssetID.incr(asset_id);
|
||||
}
|
||||
Comments.countByAssetID.incr(asset_id);
|
||||
|
||||
if (pubsub) {
|
||||
|
||||
// Publish the newly added comment via the subscription.
|
||||
pubsub.publish('commentAdded', comment);
|
||||
}
|
||||
}
|
||||
|
||||
return comment;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -65,7 +63,7 @@ const createComment = ({user, loaders: {Comments}, pubsub}, {body, asset_id, par
|
||||
* @param {String} [asset_id] id of asset comment is posted on
|
||||
* @return {Object} resolves to the wordlist results
|
||||
*/
|
||||
const filterNewComment = ({body, asset_id}) => {
|
||||
const filterNewComment = (context, {body, asset_id}) => {
|
||||
|
||||
// Create a new instance of the Wordlist.
|
||||
const wl = new Wordlist();
|
||||
@@ -85,50 +83,40 @@ const filterNewComment = ({body, asset_id}) => {
|
||||
* @param {Object} [wordlist={}] the results of the wordlist scan
|
||||
* @return {Promise} resolves to the comment's status
|
||||
*/
|
||||
const resolveNewCommentStatus = ({asset_id, body}, wordlist = {}, settings = {}) => {
|
||||
const resolveNewCommentStatus = async (context, {asset_id, body}, wordlist = {}, settings = {}) => {
|
||||
|
||||
// Decide the status based on whether or not the current asset/settings
|
||||
// has pre-mod enabled or not. If the comment was rejected based on the
|
||||
// wordlist, then reject it, otherwise if the moderation setting is
|
||||
// premod, set it to `premod`.
|
||||
let status;
|
||||
|
||||
if (wordlist.banned) {
|
||||
status = Promise.resolve('REJECTED');
|
||||
} else if (settings.premodLinksEnable && linkify.test(body)) {
|
||||
status = Promise.resolve('PREMOD');
|
||||
} else if (asset_id) {
|
||||
status = AssetsService
|
||||
.rectifySettings(AssetsService.findById(asset_id).then((asset) => {
|
||||
if (!asset) {
|
||||
return Promise.reject(errors.ErrNotFound);
|
||||
}
|
||||
|
||||
// Check to see if the asset has closed commenting...
|
||||
if (asset.isClosed) {
|
||||
|
||||
// They have, ensure that we send back an error.
|
||||
return Promise.reject(new errors.ErrAssetCommentingClosed(asset.closedMessage));
|
||||
}
|
||||
|
||||
return asset;
|
||||
}))
|
||||
|
||||
// Return `premod` if pre-moderation is enabled and an empty "new" status
|
||||
// in the event that it is not in pre-moderation mode.
|
||||
.then(({moderation, charCountEnable, charCount}) => {
|
||||
|
||||
// Reject if the comment is too long
|
||||
if (charCountEnable && body.length > charCount) {
|
||||
return 'REJECTED';
|
||||
}
|
||||
return moderation === 'PRE' ? 'PREMOD' : 'NONE';
|
||||
});
|
||||
} else {
|
||||
status = 'NONE';
|
||||
return 'REJECTED';
|
||||
}
|
||||
|
||||
if (settings.premodLinksEnable && linkify.test(body)) {
|
||||
return 'PREMOD';
|
||||
}
|
||||
|
||||
return status;
|
||||
let asset = await AssetsService.findById(asset_id);
|
||||
if (!asset) {
|
||||
throw errors.ErrNotFound;
|
||||
}
|
||||
|
||||
// Check to see if the asset has closed commenting...
|
||||
if (asset.isClosed) {
|
||||
throw new errors.ErrAssetCommentingClosed(asset.closedMessage);
|
||||
}
|
||||
|
||||
// Return `premod` if pre-moderation is enabled and an empty "new" status
|
||||
// in the event that it is not in pre-moderation mode.
|
||||
let {moderation, charCountEnable, charCount} = await AssetsService.rectifySettings(asset);
|
||||
|
||||
// Reject if the comment is too long
|
||||
if (charCountEnable && body.length > charCount) {
|
||||
return 'REJECTED';
|
||||
}
|
||||
|
||||
return moderation === 'PRE' ? 'PREMOD' : 'NONE';
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -139,45 +127,42 @@ const resolveNewCommentStatus = ({asset_id, body}, wordlist = {}, settings = {})
|
||||
* @param {Object} commentInput the new comment to be created
|
||||
* @return {Promise} resolves to a new comment
|
||||
*/
|
||||
const createPublicComment = (context, commentInput) => {
|
||||
const createPublicComment = async (context, commentInput) => {
|
||||
|
||||
// First we filter the comment contents to ensure that we note any validation
|
||||
// issues.
|
||||
return filterNewComment(commentInput)
|
||||
let [wordlist, settings] = await filterNewComment(context, commentInput);
|
||||
|
||||
// We then take the wordlist and the comment into consideration when
|
||||
// considering what status to assign the new comment, and resolve the new
|
||||
// status to set the comment to.
|
||||
.then(([wordlist, settings]) => resolveNewCommentStatus(commentInput, wordlist, settings)
|
||||
// We then take the wordlist and the comment into consideration when
|
||||
// considering what status to assign the new comment, and resolve the new
|
||||
// status to set the comment to.
|
||||
let status = await resolveNewCommentStatus(context, commentInput, wordlist, settings);
|
||||
|
||||
// Then we actually create the comment with the new status.
|
||||
.then((status) => createComment(context, commentInput, status))
|
||||
.then((comment) => {
|
||||
// Then we actually create the comment with the new status.
|
||||
let comment = await createComment(context, commentInput, status);
|
||||
|
||||
// If the comment has a suspect word or a link, we need to add a
|
||||
// flag to it to indicate that it needs to be looked at.
|
||||
// Otherwise just return the new comment.
|
||||
// If the comment has a suspect word or a link, we need to add a
|
||||
// flag to it to indicate that it needs to be looked at.
|
||||
// Otherwise just return the new comment.
|
||||
|
||||
// TODO: Check why the wordlist is undefined
|
||||
if (wordlist != null && wordlist.suspect != null) {
|
||||
// TODO: Check why the wordlist is undefined
|
||||
if (wordlist != null && wordlist.suspect != null) {
|
||||
|
||||
// TODO: this is kind of fragile, we should refactor this to resolve
|
||||
// all these const's that we're using like 'COMMENTS', 'FLAG' to be
|
||||
// defined in a checkable schema.
|
||||
return ActionsService.insertUserAction({
|
||||
item_id: comment.id,
|
||||
item_type: 'COMMENTS',
|
||||
action_type: 'FLAG',
|
||||
user_id: null,
|
||||
group_id: 'Matched suspect word filter',
|
||||
metadata: {}
|
||||
})
|
||||
.then(() => comment);
|
||||
}
|
||||
// TODO: this is kind of fragile, we should refactor this to resolve
|
||||
// all these const's that we're using like 'COMMENTS', 'FLAG' to be
|
||||
// defined in a checkable schema.
|
||||
await ActionsService.insertUserAction({
|
||||
item_id: comment.id,
|
||||
item_type: 'COMMENTS',
|
||||
action_type: 'FLAG',
|
||||
user_id: null,
|
||||
group_id: 'Matched suspect word filter',
|
||||
metadata: {}
|
||||
});
|
||||
}
|
||||
|
||||
// Finally, we return the comment.
|
||||
return comment;
|
||||
}));
|
||||
// Finally, we return the comment.
|
||||
return comment;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -187,26 +172,23 @@ const createPublicComment = (context, commentInput) => {
|
||||
* @param {String} status the new status of the comment
|
||||
*/
|
||||
|
||||
const setCommentStatus = ({user, loaders: {Comments}}, {id, status}) => {
|
||||
return CommentsService
|
||||
.pushStatus(id, status, user ? user.id : null)
|
||||
.then((comment) => {
|
||||
const setCommentStatus = async ({user, loaders: {Comments}}, {id, status}) => {
|
||||
let comment = await CommentsService.pushStatus(id, status, user ? user.id : null);
|
||||
|
||||
// If the loaders are present, clear the caches for these values because we
|
||||
// just added a new comment, hence the counts should be updated. It would
|
||||
// be nice if we could decrement the counters here, but that would result
|
||||
// in us having to know the initial state of the comment, which would
|
||||
// require another database query.
|
||||
if (comment.parent_id != null) {
|
||||
Comments.countByParentID.clear(comment.parent_id);
|
||||
} else {
|
||||
Comments.parentCountByAssetID.clear(comment.asset_id);
|
||||
}
|
||||
// If the loaders are present, clear the caches for these values because we
|
||||
// just added a new comment, hence the counts should be updated. It would
|
||||
// be nice if we could decrement the counters here, but that would result
|
||||
// in us having to know the initial state of the comment, which would
|
||||
// require another database query.
|
||||
if (comment.parent_id != null) {
|
||||
Comments.countByParentID.clear(comment.parent_id);
|
||||
} else {
|
||||
Comments.parentCountByAssetID.clear(comment.asset_id);
|
||||
}
|
||||
|
||||
Comments.countByAssetID.clear(comment.asset_id);
|
||||
Comments.countByAssetID.clear(comment.asset_id);
|
||||
|
||||
return comment;
|
||||
});
|
||||
return comment;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -233,29 +215,16 @@ const removeCommentTag = ({user, loaders: {Comments}}, {id, tag}) => {
|
||||
* @param {Object} edit describes how to edit the comment
|
||||
* @param {String} edit.body the new Comment body
|
||||
*/
|
||||
const editComment = async ({user, loaders: {Comments}}, {id, asset_id, edit}) => {
|
||||
const {body} = edit;
|
||||
const determineStatusForComment = async ({body, asset_id}) => {
|
||||
const [wordlist, settings] = await filterNewComment({asset_id, body});
|
||||
const status = await resolveNewCommentStatus({asset_id, body}, wordlist, settings);
|
||||
return status;
|
||||
};
|
||||
const status = await determineStatusForComment({body, asset_id});
|
||||
try {
|
||||
await CommentsService.edit(id, asset_id, user.id, Object.assign({status}, edit));
|
||||
} catch (error) {
|
||||
switch (error.name) {
|
||||
case 'CommentNotFound':
|
||||
throw new errors.APIError('Comment not found', {
|
||||
status: 404,
|
||||
translation_key: 'NOT_FOUND',
|
||||
});
|
||||
case 'NotAuthorizedToEdit':
|
||||
throw errors.ErrNotAuthorized;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
const editComment = async (context, {id, asset_id, edit: {body}}) => {
|
||||
|
||||
// Get the wordlist and the settings object.
|
||||
const [wordlist, settings] = await filterNewComment(context, {asset_id, body});
|
||||
|
||||
// Determine the new status of the comment.
|
||||
const status = await resolveNewCommentStatus(context, {asset_id, body}, wordlist, settings);
|
||||
|
||||
await CommentsService.edit(id, context.user.id, {body, status});
|
||||
|
||||
return {status};
|
||||
};
|
||||
|
||||
|
||||
+6
-10
@@ -2,23 +2,19 @@ const errors = require('../../errors');
|
||||
const UsersService = require('../../services/users');
|
||||
|
||||
const setUserStatus = ({user}, {id, status}) => {
|
||||
return UsersService.setStatus(id, status)
|
||||
.then(res => res);
|
||||
return UsersService.setStatus(id, status);
|
||||
};
|
||||
|
||||
const suspendUser = ({user}, {id, message}) => {
|
||||
return UsersService.suspendUser(id, message)
|
||||
.then(res => {
|
||||
return res;
|
||||
});
|
||||
return UsersService.suspendUser(id, message);
|
||||
};
|
||||
|
||||
const ignoreUser = async ({user}, userToIgnore) => {
|
||||
return await UsersService.ignoreUsers(user.id, [userToIgnore.id]);
|
||||
const ignoreUser = ({user}, userToIgnore) => {
|
||||
return UsersService.ignoreUsers(user.id, [userToIgnore.id]);
|
||||
};
|
||||
|
||||
const stopIgnoringUser = async ({user}, userToStopIgnoring) => {
|
||||
return await UsersService.stopIgnoringUsers(user.id, [userToStopIgnoring.id]);
|
||||
const stopIgnoringUser = ({user}, userToStopIgnoring) => {
|
||||
return UsersService.stopIgnoringUsers(user.id, [userToStopIgnoring.id]);
|
||||
};
|
||||
|
||||
module.exports = (context) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ const Asset = {
|
||||
return Comments.genRecentComments.load(id);
|
||||
},
|
||||
comments({id}, {sort, limit, excludeIgnored}, {loaders: {Comments}}) {
|
||||
return Comments.getByQuery({
|
||||
return Comments.getConnection({
|
||||
asset_id: id,
|
||||
sort,
|
||||
limit,
|
||||
|
||||
+28
-15
@@ -1,3 +1,12 @@
|
||||
################################################################################
|
||||
## Pagination
|
||||
################################################################################
|
||||
|
||||
type PageInfo {
|
||||
hasNextPage: Boolean!
|
||||
cursor: String
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## Custom Scalar Types
|
||||
################################################################################
|
||||
@@ -37,16 +46,13 @@ type User {
|
||||
actions: [Action]
|
||||
|
||||
# the current roles of the user.
|
||||
roles: [USER_ROLES]
|
||||
roles: [USER_ROLES!]
|
||||
|
||||
# determines whether the user can edit their username
|
||||
canEditName: Boolean
|
||||
|
||||
# returns all comments based on a query.
|
||||
comments(query: CommentsQuery): [Comment]
|
||||
|
||||
# returns all users based on a query.
|
||||
users(query: UsersQuery): [User]
|
||||
comments(query: CommentsQuery): [Comment!]
|
||||
|
||||
# returns user status
|
||||
status: USER_STATUS
|
||||
@@ -81,6 +87,12 @@ input UsersQuery {
|
||||
## Comments
|
||||
################################################################################
|
||||
|
||||
# CommentConnection provides Comments with PageInfo.
|
||||
type CommentConnection {
|
||||
edges: [Comment!]
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
# The statuses that a comment may have.
|
||||
enum COMMENT_STATUS {
|
||||
|
||||
@@ -190,7 +202,7 @@ type Comment {
|
||||
recentReplies: [Comment]
|
||||
|
||||
# the replies that were made to the comment.
|
||||
replies(sort: SORT_ORDER = CHRONOLOGICAL, limit: Int = 3, excludeIgnored: Boolean): [Comment]
|
||||
replies(sort: SORT_ORDER = CHRONOLOGICAL, limit: Int = 3, excludeIgnored: Boolean): CommentConnection
|
||||
|
||||
# The count of replies on a comment.
|
||||
replyCount(excludeIgnored: Boolean): Int
|
||||
@@ -429,7 +441,7 @@ type Asset {
|
||||
recentComments: [Comment]
|
||||
|
||||
# The top level comments that are attached to the asset.
|
||||
comments(sort: SORT_ORDER = REVERSE_CHRONOLOGICAL, limit: Int = 10, excludeIgnored: Boolean): [Comment]
|
||||
comments(sort: SORT_ORDER = REVERSE_CHRONOLOGICAL, limit: Int = 10, excludeIgnored: Boolean): CommentConnection
|
||||
|
||||
# The count of top level comments on the asset.
|
||||
commentCount(excludeIgnored: Boolean): Int
|
||||
@@ -536,7 +548,7 @@ type RootQuery {
|
||||
asset(id: ID, url: String): Asset
|
||||
|
||||
# Comments returned based on a query.
|
||||
comments(query: CommentsQuery!): [Comment]
|
||||
comments(query: CommentsQuery!): CommentConnection!
|
||||
|
||||
# Return the count of comments satisfied by the query. Note that this edge is
|
||||
# expensive as it is not batched. Requires the `ADMIN` role.
|
||||
@@ -600,6 +612,7 @@ enum TAG_TYPE {
|
||||
STAFF
|
||||
}
|
||||
|
||||
# CreateCommentInput is the input content used to create a new comment.
|
||||
input CreateCommentInput {
|
||||
|
||||
# The asset id
|
||||
@@ -729,19 +742,19 @@ type StopIgnoringUserResponse implements Response {
|
||||
errors: [UserError]
|
||||
}
|
||||
|
||||
# Input to editComment mutation
|
||||
# Input to editComment mutation.
|
||||
input EditCommentInput {
|
||||
|
||||
# Update body of the comment
|
||||
body: String!
|
||||
}
|
||||
|
||||
type CommentInfoAfterEdit {
|
||||
# New status of the edited comment
|
||||
status: COMMENT_STATUS!
|
||||
}
|
||||
|
||||
# EditCommentResponse contains the updated comment and any errors that occured.
|
||||
type EditCommentResponse implements Response {
|
||||
comment: CommentInfoAfterEdit!
|
||||
|
||||
# The edited comment.
|
||||
comment: Comment
|
||||
|
||||
# An array of errors relating to the mutation that occured.
|
||||
errors: [UserError]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user