Skip to content

Commit

Permalink
get_reply_by_id_async
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyZhao committed Feb 19, 2012
1 parent 8d8faea commit 648cfaa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions controllers/reply.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,24 @@ function get_replies_by_topic_id(id,cb){
};
exports.get_reply_by_id = get_reply_by_id;
exports.get_replies_by_topic_id = get_replies_by_topic_id;

/******** Jscex ***********/
var Jscex = require("../libs/jscex").Jscex;

var get_reply_by_id_async = eval(Jscex.compile("async", function (id) {
var reply = $await(Reply.findOneAsync({ _id: id }));
if (!reply) return null;

reply.author = $await(user_ctrl.get_user_by_id_async(reply.author_id));
reply.friendly_create_at = Util.format_date(reply.create_at,true);

if (!reply.content_is_html) {
reply.content = Markdown(reply.content, true);
}

reply.content = $await(at_ctrl.link_at_who_async(reply.content));

return reply;
}));

exports.get_reply_by_id_async = get_reply_by_id_async;

0 comments on commit 648cfaa

Please sign in to comment.