|
|
@@ -254,11 +254,36 @@ module.exports = function(crowi, app) {
|
|
|
// app.get( '/users/:username([^/]+)/bookmarks' , loginRequired(crowi, app) , page.userBookmarkList);
|
|
|
actions.userBookmarkList = function(req, res) {
|
|
|
var username = req.params.username;
|
|
|
+ var offset = req.query.offset || 0;
|
|
|
+ var userData;
|
|
|
+ var renderVars = {};
|
|
|
+
|
|
|
+ User.findUserByUsername(username)
|
|
|
+ .then(function(data) {
|
|
|
+ if (data === null) {
|
|
|
+ throw new Error('The user not found.');
|
|
|
+ }
|
|
|
+ renderVars.pageUser = userData = data;
|
|
|
+
|
|
|
+ return Bookmark.findByUser(userData, {offset: offset, limit: 50}).then(function(bookmarkList) {
|
|
|
+ return Page.findListByPageIds(Object.keys(bookmarkList).map(function(e) { return bookmarkList[e].page; }), {});
|
|
|
+ });
|
|
|
+ }).catch(function(err) {
|
|
|
+ debug('Error on rendereing bookmark', err);
|
|
|
+ res.redirect('/');
|
|
|
+ });
|
|
|
+ return res.render('user/bookmarks', {
|
|
|
+ username: username
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
- // app.get( '/users/:username([^/]+)/recent-created' , loginRequired(crowi, app) , page.userRecentCreatedList);
|
|
|
+ // app.get( '/users/:username([^/]+)/recent-create' , loginRequired(crowi, app) , page.userRecentCreatedList);
|
|
|
actions.userRecentCreatedList = function(req, res) {
|
|
|
var username = req.params.username;
|
|
|
+
|
|
|
+ return res.render('user/recent-create', {
|
|
|
+ username: username
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
var api = actions.api = {};
|