Skip to content

Commit dd4ccfe

Browse files
authored
Merge pull request #248 from SoftwareEngineeringDaily/hot-fixes
Hot fixes
2 parents ba8cc7b + 0d33001 commit dd4ccfe

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

server/controllers/feed.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function getLinks(req) {
2828
if (req.user) query.user = req.user;
2929

3030
const {
31-
limit = 15,
31+
limit = 10,
3232
} = req.query;
3333

3434
query.limit = limit;

server/controllers/post.controller.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import raccoon from 'raccoon';
2-
import mongoose from 'mongoose';
1+
// import mongoose from 'mongoose';
32

43
import Post from '../models/post.model';
54
import {
@@ -176,8 +175,10 @@ function list(req, res, next) {
176175
* $ref: '#/responses/NotFound'
177176
*/
178177

179-
function recommendations(req, res, next) {
180-
const numberOfRecommendations = 10;
178+
function recommendations(req, res) {
179+
// const numberOfRecommendations = 10;
180+
res.json([]);
181+
/*
181182
raccoon
182183
.recommendFor(req.user._id.toString(), numberOfRecommendations)
183184
.then((recommendationsFound) => {
@@ -193,25 +194,30 @@ function recommendations(req, res, next) {
193194
.catch((e) => {
194195
next(e);
195196
});
197+
*/
196198
}
197199

198200
function upvote(req, res, next) {
201+
/*
199202
const userIdString = req.user._id.toString();
200203
const postIdString = req.post._id.toString();
201204
if (req.liked) {
202-
raccoon.liked(userIdString, postIdString);
205+
// raccoon.liked(userIdString, postIdString);
203206
} else if (req.unliked) {
204-
raccoon.unliked(userIdString, postIdString);
207+
// raccoon.unliked(userIdString, postIdString);
205208
}
209+
*/
206210
next();
207211
}
208212

209213
function downvote(req, res, next) {
214+
/*
210215
if (req.undisliked) {
211-
raccoon.undisliked(req.user._id.toString(), req.post._id.toString());
216+
// raccoon.undisliked(req.user._id.toString(), req.post._id.toString());
212217
} else if (req.disliked) {
213-
raccoon.disliked(req.user._id.toString(), req.post._id.toString());
218+
// raccoon.disliked(req.user._id.toString(), req.post._id.toString());
214219
}
220+
*/
215221
next();
216222
}
217223

server/models/feedItem.model.js

+4
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,20 @@ const FeedItemSchema = new Schema({
1919
FeedItemSchema.statics = {
2020
// This doesn't paginate currently:
2121
list({
22+
limit = 10,
2223
user = null
2324
} = {}) {
2425
const query = { user };
26+
const limitOption = parseInt(limit, 10);
27+
2528
return this.find(query)
2629
.populate('user', '-password')
2730
// Deep populate: https://github.com/Automattic/mongoose/issues/5696
2831
.populate({ path: 'relatedLink', populate: { path: 'author' } })
2932
.populate({ path: 'relatedLink', populate: { path: 'post' } })
3033
// .populate({ path: 'relatedLink', populate: { path: 'post', populate: { path: 'thread' } } })
3134
.sort({ randomOrder: -1 })
35+
.limit(limitOption)
3236
.exec()
3337
.then((itemsFound) => {
3438
const foundProcessed = itemsFound.map((item) => {

0 commit comments

Comments
 (0)