Permalink
Browse files

Revert "reformat code"

This reverts commit 5426982.
  • Loading branch information...
1 parent 5426982 commit 183fed23ca18f310a30b40396bffd3002edfc5a6 @alsotang alsotang committed Jul 1, 2015
Showing with 1,323 additions and 1,351 deletions.
  1. +1 −0 .jshintrc
  2. +5 −5 api/v1/message.js
  3. +2 −2 api/v1/middleware.js
  4. +9 −9 api/v1/reply.js
  5. +22 −22 api/v1/topic.js
  6. +10 −10 api/v1/user.js
  7. +9 −9 api_router_v1.js
  8. +1 −1 app.js
  9. +3 −3 common/at.js
  10. +2 −2 common/cache.js
  11. +10 −10 common/logger.js
  12. +7 −7 common/mail.js
  13. +14 −14 common/message.js
  14. +16 −16 common/push.js
  15. +14 −14 common/render_helper.js
  16. +1 −1 common/store.js
  17. +6 −6 common/store_local.js
  18. +1 −1 common/store_qn.js
  19. +3 −5 config.default.js
  20. +7 −7 controllers/github.js
  21. +2 −2 controllers/message.js
  22. +9 −9 controllers/reply.js
  23. +7 −7 controllers/rss.js
  24. +31 −35 controllers/sign.js
  25. +15 −17 controllers/site.js
  26. +8 −9 controllers/static.js
  27. +41 −41 controllers/topic.js
  28. +19 −21 controllers/user.js
  29. +7 −7 middlewares/auth.js
  30. +2 −2 middlewares/error_page.js
  31. +2 −2 middlewares/limit.js
  32. +1 −1 middlewares/mongoose_log.js
  33. +6 −6 middlewares/proxy.js
  34. +5 −5 models/index.js
  35. +10 −10 models/message.js
  36. +10 −10 models/reply.js
  37. +18 −18 models/topic.js
  38. +6 −6 models/topic_collect.js
  39. +29 −29 models/user.js
  40. +4 −4 proxy/index.js
  41. +2 −2 proxy/message.js
  42. +12 −12 proxy/reply.js
  43. +12 −12 proxy/topic.js
  44. +2 −2 proxy/topic_collect.js
  45. +11 −11 proxy/user.js
  46. +2 −2 public/javascripts/main.js
  47. +23 −23 public/stylesheets/common.css
  48. +62 −62 public/stylesheets/responsive.css
  49. +12 −11 public/stylesheets/style.less
  50. +2 −2 test/api/v1/reply.test.js
  51. +1 −0 test/api/v1/tools.test.js
  52. +2 −0 test/api/v1/topic.test.js
  53. +2 −0 test/api/v1/user.test.js
  54. +25 −25 test/common/message.test.js
  55. +3 −5 test/controllers/github.test.js
  56. +6 −6 test/controllers/message.test.js
  57. +74 −74 test/controllers/reply.test.js
  58. +85 −85 test/controllers/sign.test.js
  59. +4 −4 test/controllers/site.test.js
  60. +4 −4 test/controllers/static.test.js
  61. +146 −145 test/controllers/topic.test.js
  62. +115 −115 test/controllers/user.test.js
  63. +5 −7 test/middlewares/conf.test.js
  64. +5 −5 views/_sponsors.html
  65. +4 −4 views/index.html
  66. +13 −23 views/layout.html
  67. +3 −3 views/message/message.html
  68. +1 −1 views/notify/notify.html
  69. +1 −1 views/reply/edit.html
  70. +43 −43 views/reply/reply.html
  71. +3 −4 views/sidebar.html
  72. +26 −26 views/sign/new_oauth.html
  73. +1 −2 views/sign/signup.html
  74. +12 −13 views/static/about.html
  75. +113 −113 views/static/api.html
  76. +24 −24 views/static/getstart.html
  77. +1 −1 views/topic/abstract.html
  78. +7 −8 views/topic/edit.html
  79. +46 −49 views/topic/index.html
  80. +1 −1 views/topic/list.html
  81. +1 −1 views/user/index.html
  82. +8 −8 views/user/replies.html
  83. +3 −7 views/user/setting.html
  84. +5 −5 views/user/top100.html
  85. +8 −8 views/user/topics.html
  86. +6 −6 views/user/user.html
  87. +1 −1 web_router.js
View
@@ -15,6 +15,7 @@
"ace",
"$"
],
+
"browser": true,
"node": true,
"es5": true,
View
@@ -1,6 +1,6 @@
var eventproxy = require('eventproxy');
-var Message = require('../../proxy').Message;
-var _ = require('lodash');
+var Message = require('../../proxy').Message;
+var _ = require('lodash');
var index = function (req, res, next) {
var user_id = req.user._id;
@@ -26,9 +26,9 @@ var index = function (req, res, next) {
});
docs = docs.map(function (doc) {
doc.author = _.pick(doc.author, ['loginname', 'avatar_url']);
- doc.topic = _.pick(doc.topic, ['id', 'author', 'title', 'last_reply_at']);
- doc.reply = _.pick(doc.reply, ['id', 'content', 'ups', 'create_at']);
- doc = _.pick(doc, ['id', 'type', 'has_read', 'author', 'topic', 'reply']);
+ doc.topic = _.pick(doc.topic, ['id', 'author', 'title', 'last_reply_at']);
+ doc.reply = _.pick(doc.reply, ['id', 'content', 'ups', 'create_at']);
+ doc = _.pick(doc, ['id', 'type', 'has_read', 'author', 'topic', 'reply']);
return doc;
});
@@ -1,6 +1,6 @@
-var UserModel = require('../../models').User;
+var UserModel = require('../../models').User;
var eventproxy = require('eventproxy');
-var validator = require('validator');
+var validator = require('validator');
var auth = function (req, res, next) {
var ep = new eventproxy();
View
@@ -1,15 +1,15 @@
var eventproxy = require('eventproxy');
-var validator = require('validator');
-var Topic = require('../../proxy').Topic;
-var User = require('../../proxy').User;
-var Reply = require('../../proxy').Reply;
-var at = require('../../common/at');
-var message = require('../../common/message');
-var config = require('../../config');
+var validator = require('validator');
+var Topic = require('../../proxy').Topic;
+var User = require('../../proxy').User;
+var Reply = require('../../proxy').Reply;
+var at = require('../../common/at');
+var message = require('../../common/message');
+var config = require('../../config');
var create = function (req, res, next) {
var topic_id = req.params.topic_id;
- var content = req.body.content;
+ var content = req.body.content;
var reply_id = req.body.reply_id;
var ep = new eventproxy();
@@ -76,7 +76,7 @@ exports.create = create;
var ups = function (req, res, next) {
var replyId = req.params.reply_id;
- var userId = req.user.id;
+ var userId = req.user.id;
Reply.getReplyById(replyId, function (err, reply) {
if (err) {
View
@@ -1,21 +1,21 @@
-var models = require('../../models');
-var TopicModel = models.Topic;
-var TopicProxy = require('../../proxy').Topic;
+var models = require('../../models');
+var TopicModel = models.Topic;
+var TopicProxy = require('../../proxy').Topic;
var TopicCollect = require('../../proxy').TopicCollect;
-var UserProxy = require('../../proxy').User;
-var UserModel = models.User;
-var config = require('../../config');
-var eventproxy = require('eventproxy');
-var _ = require('lodash');
-var at = require('../../common/at');
+var UserProxy = require('../../proxy').User;
+var UserModel = models.User;
+var config = require('../../config');
+var eventproxy = require('eventproxy');
+var _ = require('lodash');
+var at = require('../../common/at');
var renderHelper = require('../../common/render_helper');
-var validator = require('validator');
+var validator = require('validator');
var index = function (req, res, next) {
- var page = parseInt(req.query.page, 10) || 1;
- page = page > 0 ? page : 1;
- var tab = req.query.tab || 'all';
- var limit = Number(req.query.limit) || config.list_topic_count;
+ var page = parseInt(req.query.page, 10) || 1;
+ page = page > 0 ? page : 1;
+ var tab = req.query.tab || 'all';
+ var limit = Number(req.query.limit) || config.list_topic_count;
var mdrender = req.query.mdrender === 'false' ? false : true;
var query = {};
@@ -27,7 +27,7 @@ var index = function (req, res, next) {
}
}
query.deleted = false;
- var options = {skip: (page - 1) * limit, limit: limit, sort: '-top -last_reply_at'};
+ var options = { skip: (page - 1) * limit, limit: limit, sort: '-top -last_reply_at'};
var ep = new eventproxy();
ep.fail(next);
@@ -59,9 +59,9 @@ var index = function (req, res, next) {
exports.index = index;
var show = function (req, res, next) {
- var topicId = req.params.id;
+ var topicId = req.params.id;
var mdrender = req.query.mdrender === 'false' ? false : true;
- var ep = new eventproxy();
+ var ep = new eventproxy();
ep.fail(next);
@@ -82,7 +82,7 @@ var show = function (req, res, next) {
reply.content = renderHelper.markdown(at.linkUsers(reply.content));
}
reply.author = _.pick(reply.author, ['loginname', 'avatar_url']);
- reply = _.pick(reply, ['id', 'author', 'content', 'ups', 'create_at']);
+ reply = _.pick(reply, ['id', 'author', 'content', 'ups', 'create_at']);
return reply;
});
res.send({data: topic});
@@ -92,10 +92,10 @@ var show = function (req, res, next) {
exports.show = show;
var create = function (req, res, next) {
- var title = validator.trim(req.body.title);
- title = validator.escape(title);
- var tab = validator.trim(req.body.tab);
- tab = validator.escape(tab);
+ var title = validator.trim(req.body.title);
+ title = validator.escape(title);
+ var tab = validator.trim(req.body.tab);
+ tab = validator.escape(tab);
var content = validator.trim(req.body.content);
// 得到所有的 tab, e.g. ['ask', 'share', ..]
View
@@ -1,14 +1,14 @@
-var _ = require('lodash');
-var eventproxy = require('eventproxy');
-var UserProxy = require('../../proxy').User;
-var TopicProxy = require('../../proxy').Topic;
-var ReplyProxy = require('../../proxy').Reply;
+var _ = require('lodash');
+var eventproxy = require('eventproxy');
+var UserProxy = require('../../proxy').User;
+var TopicProxy = require('../../proxy').Topic;
+var ReplyProxy = require('../../proxy').Reply;
var TopicCollect = require('../../proxy').TopicCollect;
var show = function (req, res, next) {
var loginname = req.params.loginname;
- var ep = new eventproxy();
-
+ var ep = new eventproxy();
+
ep.fail(next);
UserProxy.getUserByLoginName(loginname, ep.done(function (user) {
@@ -52,17 +52,17 @@ var show = function (req, res, next) {
user.recent_topics = recent_topics.map(function (topic) {
topic.author = _.pick(topic.author, ['loginname', 'avatar_url']);
- topic = _.pick(topic, ['id', 'author', 'title', 'last_reply_at']);
+ topic = _.pick(topic, ['id', 'author', 'title', 'last_reply_at']);
return topic;
});
user.recent_replies = recent_replies.map(function (topic) {
topic.author = _.pick(topic.author, ['loginname', 'avatar_url']);
- topic = _.pick(topic, ['id', 'author', 'title', 'last_reply_at']);
+ topic = _.pick(topic, ['id', 'author', 'title', 'last_reply_at']);
return topic;
});
user.collect_topics = collect_topics.map(function (topic) {
topic.author = _.pick(topic.author, ['loginname', 'avatar_url']);
- topic = _.pick(topic, ['id', 'author', 'title', 'last_reply_at']);
+ topic = _.pick(topic, ['id', 'author', 'title', 'last_reply_at']);
return topic;
});
View
@@ -1,14 +1,14 @@
-var express = require('express');
-var topicController = require('./api/v1/topic');
-var userController = require('./api/v1/user');
-var toolsController = require('./api/v1/tools');
-var replyController = require('./api/v1/reply');
+var express = require('express');
+var topicController = require('./api/v1/topic');
+var userController = require('./api/v1/user');
+var toolsController = require('./api/v1/tools');
+var replyController = require('./api/v1/reply');
var messageController = require('./api/v1/message');
-var middleware = require('./api/v1/middleware');
-var limit = require('./middlewares/limit');
-var config = require('./config');
+var middleware = require('./api/v1/middleware');
+var limit = require('./middlewares/limit');
+var config = require('./config');
-var router = express.Router();
+var router = express.Router();
// 主题
View
@@ -84,7 +84,7 @@ app.use('/agent', proxyMiddleware.proxy);
app.use(require('response-time')());
app.use(helmet.frameguard('sameorigin'));
app.use(bodyParser.json({limit: '1mb'}));
-app.use(bodyParser.urlencoded({extended: true, limit: '1mb'}));
+app.use(bodyParser.urlencoded({ extended: true, limit: '1mb' }));
app.use(require('method-override')());
app.use(require('cookie-parser')(config.session_secret));
app.use(compress());
View
@@ -9,10 +9,10 @@
* Module dependencies.
*/
-var User = require('../proxy').User;
-var Message = require('./message');
+var User = require('../proxy').User;
+var Message = require('./message');
var EventProxy = require('eventproxy');
-var _ = require('lodash');
+var _ = require('lodash');
/**
* 从文本中提取出@username 标记的用户名数组
View
@@ -1,5 +1,5 @@
-var redis = require('./redis');
-var _ = require('lodash');
+var redis = require('./redis');
+var _ = require('lodash');
var logger = require('./logger');
var get = function (key, callback) {
View
@@ -1,4 +1,4 @@
-var fs = require('fs');
+var fs = require('fs');
var config = require('../config');
if (!fs.existsSync("./log")) {
@@ -38,15 +38,15 @@ var writeLog = function (prefix, logType, args) {
var logStr = infos.join(" ");
switch (logType) {
- case "debug":
- logStr = logStr.gray;
- break;
- case 'warn':
- logStr = logStr.yellow;
- break;
- case 'error':
- logStr = logStr.red;
- break;
+ case "debug":
+ logStr = logStr.gray;
+ break;
+ case 'warn':
+ logStr = logStr.yellow;
+ break;
+ case 'error':
+ logStr = logStr.red;
+ break;
}
var line = prefix + logStr;
View
@@ -1,7 +1,7 @@
-var mailer = require('nodemailer');
-var config = require('../config');
-var util = require('util');
-var transport = mailer.createTransport('SMTP', config.mail_opts);
+var mailer = require('nodemailer');
+var config = require('../config');
+var util = require('util');
+var transport = mailer.createTransport('SMTP', config.mail_opts);
var SITE_ROOT_URL = 'http://' + config.host;
/**
@@ -29,10 +29,10 @@ exports.sendMail = sendMail;
* @param {String} name 接收人的用户名
*/
exports.sendActiveMail = function (who, token, name) {
- var from = util.format('%s <%s>', config.name, config.mail_opts.auth.user);
- var to = who;
+ var from = util.format('%s <%s>', config.name, config.mail_opts.auth.user);
+ var to = who;
var subject = config.name + '社区帐号激活';
- var html = '<p>您好:' + name + '</p>' +
+ var html = '<p>您好:' + name + '</p>' +
'<p>我们收到您在' + config.name + '社区的注册信息,请点击下面的链接来激活帐户:</p>' +
'<a href = "' + SITE_ROOT_URL + '/active_account?key=' + token + '&name=' + name + '">激活链接</a>' +
'<p>若您没有在' + config.name + '社区填写过注册信息,说明有人滥用了您的电子邮箱,请删除此邮件,我们对给您造成的打扰感到抱歉。</p>' +
View
@@ -1,22 +1,22 @@
-var models = require('../models');
-var eventproxy = require('eventproxy');
-var Message = models.Message;
-var User = require('../proxy').User;
-var push = require('../common/push');
+var models = require('../models');
+var eventproxy = require('eventproxy');
+var Message = models.Message;
+var User = require('../proxy').User;
+var push = require('../common/push');
var messageProxy = require('../proxy/message');
-var _ = require('lodash');
+var _ = require('lodash');
exports.sendReplyMessage = function (master_id, author_id, topic_id, reply_id, callback) {
callback = callback || _.noop;
var ep = new eventproxy();
ep.fail(callback);
- var message = new Message();
- message.type = 'reply';
+ var message = new Message();
+ message.type = 'reply';
message.master_id = master_id;
message.author_id = author_id;
- message.topic_id = topic_id;
- message.reply_id = reply_id;
+ message.topic_id = topic_id;
+ message.reply_id = reply_id;
message.save(ep.done('message_saved'));
ep.all('message_saved', function (msg) {
@@ -30,12 +30,12 @@ exports.sendAtMessage = function (master_id, author_id, topic_id, reply_id, call
var ep = new eventproxy();
ep.fail(callback);
- var message = new Message();
- message.type = 'at';
+ var message = new Message();
+ message.type = 'at';
message.master_id = master_id;
message.author_id = author_id;
- message.topic_id = topic_id;
- message.reply_id = reply_id;
+ message.topic_id = topic_id;
+ message.reply_id = reply_id;
message.save(ep.done('message_saved'));
ep.all('message_saved', function (msg) {
Oops, something went wrong.

0 comments on commit 183fed2

Please sign in to comment.