feat(forums): new server notice message of torrent H&R status changed

#20
This commit is contained in:
OldHawk
2017-12-16 23:20:52 +08:00
parent eaac1fab60
commit 8ef930edc9
4 changed files with 20 additions and 3 deletions

View File

@@ -346,9 +346,9 @@ module.exports = {
torrentThumbsUp: {title: 'TITLE_TORRENT_THUMBS_UP', content: 'CONTENT_TORRENT_THUMBS_UP', enable: true},
torrentReviewed: {title: 'TITLE_TORRENT_REVIEWED', content: 'CONTENT_TORRENT_REVIEWED', 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},
torrentDeleted: {title: 'TITLE_TORRENT_DELETED', content: 'CONTENT_TORRENT_DELETED', enable: true},
torrentHnRChanged: {title: 'TITLE_TORRENT_HNR_CHANGED', content: 'CONTENT_TORRENT_HNR_CHANGED', enable: true},
torrentSaleChanged: {title: 'TITLE_TORRENT_SALE_CHANGED', content: 'CONTENT_TORRENT_SALE_CHANGED', enable: true}
}
},

View File

@@ -1329,7 +1329,10 @@
CONTENT_TORRENT_REVIEWED: '### Congratulate! \n :clap: You uploaded torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) was reviewed by user [{{by_name}}](/userinfo/{{by_id}}).',
TITLE_TORRENT_VIP_CHANGED: 'Torrent VIP status changed',
CONTENT_TORRENT_VIP_CHANGED: '### VIP status changed! \n You uploaded torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) VIP status was changed by user [{{by_name}}](/userinfo/{{by_id}}), current status is **{{vip_status}}**.'
CONTENT_TORRENT_VIP_CHANGED: '### VIP status changed! \n You uploaded torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) VIP status was changed by user [{{by_name}}](/userinfo/{{by_id}}), current status is **{{vip_status}}**.',
TITLE_TORRENT_HNR_CHANGED: 'Torrent H&R status changed',
CONTENT_TORRENT_HNR_CHANGED: '### H&R status changed! \n You uploaded torrent [{{torrent_file_name}}](/torrents/{{torrent_id}}) H&R status was changed by user [{{by_name}}](/userinfo/{{by_id}}), current status is **{{hnr_status}}**.'
}
};

View File

@@ -1329,7 +1329,10 @@
CONTENT_TORRENT_REVIEWED: '### 恭喜! \n :clap: 您上传的种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) 被管理员用户 [{{by_name}}](/userinfo/{{by_id}}) 审核通过.',
TITLE_TORRENT_VIP_CHANGED: '种子 VIP 状态改变',
CONTENT_TORRENT_VIP_CHANGED: '### VIP 状态改变! \n 您上传的种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) VIP 状态已经由管理员用户 [{{by_name}}](/userinfo/{{by_id}}) 修改, 当前状态为: **{{vip_status}}**.'
CONTENT_TORRENT_VIP_CHANGED: '### VIP 状态改变! \n 您上传的种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) VIP 状态已经由管理员用户 [{{by_name}}](/userinfo/{{by_id}}) 修改, 当前状态为: **{{vip_status}}**.',
TITLE_TORRENT_HNR_CHANGED: '种子 H&R 状态改变',
CONTENT_TORRENT_HNR_CHANGED: '### H&R 状态改变! \n 您上传的种子 [{{torrent_file_name}}](/torrents/{{torrent_id}}) H&R 状态已经由管理员用户 [{{by_name}}](/userinfo/{{by_id}}) 修改, 当前状态为: **{{hnr_status}}**.'
}
};

View File

@@ -797,6 +797,17 @@ exports.toggleHnRStatus = function (req, res) {
//remove the complete data and update user`s warning number when the H&R prop to false
if (!torrent.torrent_hnr)
removeTorrentHnRWarning(torrent._id);
//add server message
if (serverNoticeConfig.action.torrentHnRChanged.enable) {
serverMessage.addMessage(torrent.user._id, serverNoticeConfig.action.torrentHnRChanged.title, serverNoticeConfig.action.torrentHnRChanged.content, {
torrent_file_name: torrent.torrent_filename,
torrent_id: torrent._id,
by_name: req.user.displayName,
by_id: req.user._id,
hnr_status: torrent.torrent_hnr ? 'ON' : 'OFF'
});
}
}
});
};