Skip to content

Commit

Permalink
chore(authorization): change on authorization
Browse files Browse the repository at this point in the history
-user can get ratings, likes AND dislikes on an article while not authenticated.
[delivers #167703750]
  • Loading branch information
Kabalisa committed Aug 5, 2019
1 parent afa158e commit 698a54a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
4 changes: 1 addition & 3 deletions controllers/article.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ class ArticleController {
.status(200)
.send({ message: 'this article has not been shared yet' });
}
const numberOfSharesOnPlatform = await ArticleHelper.numberOfSharesOnPlatform(
shares
);
const numberOfSharesOnPlatform = await ArticleHelper.numberOfSharesOnPlatform(shares);
const facebook = numberOfSharesOnPlatform[0];
const twitter = numberOfSharesOnPlatform[1];
const linkedin = numberOfSharesOnPlatform[2];
Expand Down
14 changes: 6 additions & 8 deletions helpers/commentHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,12 @@ class CommentHelper {
if (!fetchedComments[0]) {
return { errors: { body: ['no commemts found on this article'] } };
}
await Promise.all(
fetchedComments.map(async (currentComment) => {
const commentId = currentComment.dataValues.id;
const commentHistories = await this.getCommentsHistories(commentId);
currentComment.dataValues.histories = commentHistories;
return currentComment;
})
);
await Promise.all(fetchedComments.map(async (currentComment) => {
const commentId = currentComment.dataValues.id;
const commentHistories = await this.getCommentsHistories(commentId);
currentComment.dataValues.histories = commentHistories;
return currentComment;
}));
return fetchedComments;
}

Expand Down
3 changes: 0 additions & 3 deletions routes/api/article/articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ router.post(
);
router.get(
'/:slug/ratings',
Auth,
catchErrors(Ratingcontroller.getArticleRating)
);
router.post(
Expand All @@ -61,13 +60,11 @@ router.post(
);
router.get(
'/:slug/likes',
Auth,
ArticleHelper.likesNumber,
articleController.getLikes
);
router.get(
'/:slug/dislikes',
Auth,
ArticleHelper.dislikesNumber,
articleController.getDislikes
);
Expand Down

0 comments on commit 698a54a

Please sign in to comment.