mirror of
https://github.com/wassname/talk.git
synced 2026-07-14 11:18:50 +08:00
Applied patch
This commit is contained in:
@@ -73,7 +73,7 @@ const getCountsByParentID = (context, parent_ids) => {
|
||||
* @param {Object} context graph context
|
||||
* @param {Object} query query terms to apply to the comments query
|
||||
*/
|
||||
const getCommentsByQuery = ({user}, {ids, statuses, asset_id, parent_id, limit, cursor, sort}) => {
|
||||
const getCommentsByQuery = ({user}, {ids, statuses, asset_id, parent_id, author_id, limit, cursor, sort}) => {
|
||||
let comments = CommentModel.find();
|
||||
|
||||
// Only administrators can search for comments with statuses that are not
|
||||
@@ -100,6 +100,10 @@ const getCommentsByQuery = ({user}, {ids, statuses, asset_id, parent_id, limit,
|
||||
});
|
||||
}
|
||||
|
||||
if (user && (user.hasRoles('ADMIN') || user.id === author_id)) {
|
||||
comments = comments.where({author_id});
|
||||
}
|
||||
|
||||
if (asset_id) {
|
||||
comments = comments.where({asset_id});
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ const User = {
|
||||
// If the user is not an admin, only return comment list for the owner of
|
||||
// the comments.
|
||||
if (user && (user.hasRoles('ADMIN') || user.id === id)) {
|
||||
return Comments.getByAuthorID.load(id);
|
||||
return Comments.getByQuery({author_id: id});
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user