feat(announce): only announce msg to irc when ircAnnounce enabled

This commit is contained in:
OldHawk
2017-09-08 11:20:55 +08:00
parent 668f0a7df4
commit 5b0d42e99a

View File

@@ -655,31 +655,33 @@ exports.setReviewedStatus = function (req, res) {
res.json(torrent);
//irc announce
var msg = '';
var client = req.app.get('ircClient');
if (ircConfig.enable) {
var msg = '';
var client = req.app.get('ircClient');
if (torrent.torrent_type === 'tvserial') {
msg = vsprintf(ircConfig.tvserialMsgFormat, [
torrent.user.displayName,
torrent.torrent_filename,
torrent.torrent_type,
torrent.torrent_size,
torrent.torrent_seasons,
torrent.torrent_episodes,
torrent.torrent_sale_status,
moment().format('YYYY-MM-DD HH:mm:ss')
]);
} else {
msg = vsprintf(ircConfig.defaultMsgFormat, [
torrent.user.displayName,
torrent.torrent_filename,
torrent.torrent_type,
torrent.torrent_size,
torrent.torrent_sale_status,
moment().format('YYYY-MM-DD HH:mm:ss')
]);
if (torrent.torrent_type === 'tvserial') {
msg = vsprintf(ircConfig.tvserialMsgFormat, [
torrent.user.displayName,
torrent.torrent_filename,
torrent.torrent_type,
torrent.torrent_size,
torrent.torrent_seasons,
torrent.torrent_episodes,
torrent.torrent_sale_status,
moment().format('YYYY-MM-DD HH:mm:ss')
]);
} else {
msg = vsprintf(ircConfig.defaultMsgFormat, [
torrent.user.displayName,
torrent.torrent_filename,
torrent.torrent_type,
torrent.torrent_size,
torrent.torrent_sale_status,
moment().format('YYYY-MM-DD HH:mm:ss')
]);
}
client.notice(ircConfig.channel, msg);
}
client.notice(ircConfig.channel, msg);
//create trace log
traceLogCreate(req, traceConfig.action.AdminTorrentSetReviewedStatus, {