wip flagged posts

v1.18.x
barisusakli 9 years ago
parent 0bea912077
commit 086e99de5c

@ -12,6 +12,7 @@ var helpers = require('./helpers');
var Controllers = {
topics: require('./topics'),
posts: require('./posts'),
categories: require('./categories'),
category: require('./category'),
unread: require('./unread'),

@ -0,0 +1,32 @@
"use strict";
var posts = require('../posts');
var postsController = {};
postsController.flagged = function(req, res, next) {
function done(err, posts) {
if (err) {
return next(err);
}
res.render('admin/manage/flags', {posts: posts, next: stop + 1, byUsername: byUsername});
}
var sortBy = req.query.sortBy || 'count';
var byUsername = req.query.byUsername || '';
var start = 0;
var stop = 19;
if (byUsername) {
posts.getUserFlags(byUsername, sortBy, req.uid, start, stop, done);
} else {
var set = sortBy === 'count' ? 'posts:flags:count' : 'posts:flagged';
posts.getFlags(set, req.uid, start, stop, done);
}
};
module.exports = postsController;

@ -36,6 +36,10 @@ function mainRoutes(app, middleware, controllers) {
setupPageRoute(app, '/tos', middleware, [], controllers.termsOfUse);
}
function postRoutes(app, middleware, controllers) {
setupPageRoute(app, '/posts/flagged', middleware, [], controllers.posts.flagged);
}
function topicRoutes(app, middleware, controllers) {
setupPageRoute(app, '/topic/:topic_id/:slug/:post_index?', middleware, [], controllers.topics.get);
setupPageRoute(app, '/topic/:topic_id/:slug?', middleware, [], controllers.topics.get);
@ -107,6 +111,7 @@ module.exports = function(app, middleware) {
mainRoutes(router, middleware, controllers);
topicRoutes(router, middleware, controllers);
postRoutes(router, middleware, controllers);
tagRoutes(router, middleware, controllers);
categoryRoutes(router, middleware, controllers);
accountRoutes(router, middleware, controllers);

@ -5,6 +5,7 @@
urlArgs: "{config.cache-buster}",
paths: {
'forum': '../client',
'admin': '../admin',
'vendor': '../../vendor',
'mousetrap': '../../bower/mousetrap/mousetrap'
}

Loading…
Cancel
Save