mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-06-19 20:49:33 +02:00
feat(forums): new server notice message of torrent review status change and thumbs up
#20
This commit is contained in:
2
config/env/torrents.js
vendored
2
config/env/torrents.js
vendored
@@ -343,9 +343,9 @@ module.exports = {
|
||||
|
||||
torrentNewComment: {title: 'TITLE_TORRENT_NEW_COMMENT', content: 'CONTENT_TORRENT_NEW_COMMENT', enable: true},
|
||||
torrentCommentDeleted: {title: 'TITLE_TORRENT_COMMENT_DELETED', content: 'CONTENT_TORRENT_COMMENT_DELETED', enable: true},
|
||||
|
||||
torrentThumbsUp: {title: 'TITLE_TORRENT_THUMBS_UP', content: 'CONTENT_TORRENT_THUMBS_UP', enable: true},
|
||||
torrentReviewed: {title: 'TITLE_TORRENT_REVIEWED', content: 'CONTENT_TORRENT_REVIEWED', enable: true},
|
||||
|
||||
torrentDeleted: {title: 'TITLE_TORRENT_DELETED', content: 'CONTENT_TORRENT_DELETED', enable: true},
|
||||
torrentVipChanged: {title: 'TITLE_TORRENT_VIP_CHANGED', content: 'CONTENT_TORRENT_VIP_CHANGED', enable: true},
|
||||
torrentHnRChanged: {title: 'TITLE_TORRENT_HNR_CHANGED', content: 'CONTENT_TORRENT_HNR_CHANGED', enable: true},
|
||||
|
||||
@@ -1320,7 +1320,13 @@
|
||||
CONTENT_TORRENT_NEW_COMMENT: '### New comment! \n :collision: You uploaded torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) has a new comment submit by user [{{by_name}}](/userinfo/{{by_id}}).',
|
||||
|
||||
TITLE_TORRENT_COMMENT_DELETED: 'Torrent comment was deleted',
|
||||
CONTENT_TORRENT_COMMENT_DELETED: 'You posted comment of torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) was deleted by user [{{by_name}}](/userinfo/{{by_id}}).'
|
||||
CONTENT_TORRENT_COMMENT_DELETED: 'You posted comment of torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) was deleted by user [{{by_name}}](/userinfo/{{by_id}}).',
|
||||
|
||||
TITLE_TORRENT_THUMBS_UP: 'Torrent was be thumbs up',
|
||||
CONTENT_TORRENT_THUMBS_UP: '### Thumbs up! \n :+1: You uploaded torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) was be thumbs up by user [{{by_name}}](/userinfo/{{by_id}}).',
|
||||
|
||||
TITLE_TORRENT_REVIEWED: 'Torrent was reviewed',
|
||||
CONTENT_TORRENT_REVIEWED: '### Congratulate! \n :clap: You uploaded torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) was reviewed by user [{{by_name}}](/userinfo/{{by_id}}).'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1320,7 +1320,13 @@
|
||||
CONTENT_TORRENT_NEW_COMMENT: '### 新留言! \n :collision: 您上传的种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) 有一条新留言,提交来自用户 [{{by_name}}](/userinfo/{{by_id}}).',
|
||||
|
||||
TITLE_TORRENT_COMMENT_DELETED: '种子留言被删除',
|
||||
CONTENT_TORRENT_COMMENT_DELETED: '您在种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) 下的留言被管理员用户 [{{by_name}}](/userinfo/{{by_id}}) 删除.'
|
||||
CONTENT_TORRENT_COMMENT_DELETED: '您在种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) 下的留言被管理员用户 [{{by_name}}](/userinfo/{{by_id}}) 删除.',
|
||||
|
||||
TITLE_TORRENT_THUMBS_UP: '种子被点赞',
|
||||
CONTENT_TORRENT_THUMBS_UP: '### 点赞! \n :+1: 您上传的种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) 被用户 [{{by_name}}](/userinfo/{{by_id}}) 点赞.',
|
||||
|
||||
TITLE_TORRENT_REVIEWED: '种子被审核通过',
|
||||
CONTENT_TORRENT_REVIEWED: '### 恭喜! \n :clap: 您上传的种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) 被管理员用户 [{{by_name}}](/userinfo/{{by_id}}) 审核通过.'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -96,11 +96,11 @@ exports.update = function (req, res) {
|
||||
*/
|
||||
exports.delete = function (req, res) {
|
||||
var torrent = req.torrent;
|
||||
var commentId = undefined;
|
||||
var commentUid = undefined;
|
||||
|
||||
torrent._replies.forEach(function (r) {
|
||||
if (r._id.equals(req.params.commentId)) {
|
||||
commentId = r.user._id;
|
||||
commentUid = r.user._id;
|
||||
|
||||
torrent._replies.pull(r);
|
||||
torrent.save(function (err) {
|
||||
@@ -113,7 +113,7 @@ exports.delete = function (req, res) {
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.torrentCommentDeleted.enable) {
|
||||
serverMessage.addMessage(commentId, serverNoticeConfig.action.torrentCommentDeleted.title, serverNoticeConfig.action.torrentCommentDeleted.content, {
|
||||
serverMessage.addMessage(commentUid, serverNoticeConfig.action.torrentCommentDeleted.title, serverNoticeConfig.action.torrentCommentDeleted.content, {
|
||||
torrent_file_name: torrent.torrent_filename,
|
||||
torrent_id: torrent._id,
|
||||
by_name: req.user.displayName,
|
||||
|
||||
@@ -39,6 +39,8 @@ var itemsPerPageConfig = config.meanTorrentConfig.itemsPerPage;
|
||||
var vsprintf = require('sprintf-js').vsprintf;
|
||||
|
||||
var mtDebug = require(path.resolve('./config/lib/debug'));
|
||||
var serverMessage = require(path.resolve('./config/lib/server-message'));
|
||||
var serverNoticeConfig = config.meanTorrentConfig.serverNotice;
|
||||
|
||||
const PEERSTATE_SEEDER = 'seeder';
|
||||
const PEERSTATE_LEECHER = 'leecher';
|
||||
@@ -871,6 +873,16 @@ exports.thumbsUp = function (req, res) {
|
||||
$inc: {score: thumbsUpScore.torrent}
|
||||
}).exec();
|
||||
save();
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.torrentThumbsUp.enable) {
|
||||
serverMessage.addMessage(torrent.user._id, serverNoticeConfig.action.torrentThumbsUp.title, serverNoticeConfig.action.torrentThumbsUp.content, {
|
||||
torrent_file_name: torrent.torrent_filename,
|
||||
torrent_id: torrent._id,
|
||||
by_name: user.displayName,
|
||||
by_id: user._id
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return res.status(422).send({
|
||||
message: 'SERVER.SCORE_NOT_ENOUGH'
|
||||
@@ -1060,6 +1072,17 @@ exports.setReviewedStatus = function (req, res) {
|
||||
res.json(torrent);
|
||||
|
||||
announceTorrentToIRC(torrent, req);
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.torrentReviewed.enable) {
|
||||
serverMessage.addMessage(torrent.user._id, serverNoticeConfig.action.torrentReviewed.title, serverNoticeConfig.action.torrentReviewed.content, {
|
||||
torrent_file_name: torrent.torrent_filename,
|
||||
torrent_id: torrent._id,
|
||||
by_name: req.user.displayName,
|
||||
by_id: req.user._id
|
||||
});
|
||||
}
|
||||
|
||||
//create trace log
|
||||
traceLogCreate(req, traceConfig.action.AdminTorrentSetReviewedStatus, {
|
||||
torrent: torrent._id,
|
||||
|
||||
Reference in New Issue
Block a user