mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 11:39:19 -05:00
(Fix) Torrent Upload Chat Announcements
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Torrent;
|
||||
use App\Message;
|
||||
use App\PrivateMessage;
|
||||
use App\Wish;
|
||||
use App\Follow;
|
||||
@@ -75,7 +74,6 @@ class TorrentHelper
|
||||
}
|
||||
|
||||
$user = $torrent->user;
|
||||
$user_id = $user->id;
|
||||
$username = $user->username;
|
||||
$anon = $torrent->anon;
|
||||
|
||||
@@ -95,13 +93,6 @@ class TorrentHelper
|
||||
$user->addProgress(new UserMade900Uploads(), 1);
|
||||
}
|
||||
|
||||
// Announce To Shoutbox
|
||||
if ($anon == 0) {
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "1", 'message' => "User [url={$appurl}/" . $username . "." . $user_id . "]" . $username . "[/url] has uploaded [url={$appurl}/torrents/" . $slug . "." . $id . "]" . $torrent->name . "[/url] grab it now! :slight_smile:"]);
|
||||
} else {
|
||||
Message::create(['user_id' => "1", 'chatroom_id' => "1", 'message' => "An anonymous user has uploaded [url={$appurl}/torrents/" . $slug . "." . $id . "]" . $torrent->name . "[/url] grab it now! :slight_smile:"]);
|
||||
}
|
||||
|
||||
// Announce To IRC
|
||||
if (config('irc-bot.enabled') == true) {
|
||||
$appname = config('app.name');
|
||||
|
||||
@@ -18,11 +18,22 @@ use App\PrivateMessage;
|
||||
use App\Helpers\TorrentHelper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Repositories\ChatRepository;
|
||||
use Carbon\Carbon;
|
||||
use \Toastr;
|
||||
|
||||
class ModerationController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var ChatRepository
|
||||
*/
|
||||
private $chat;
|
||||
|
||||
public function __construct(ChatRepository $chat)
|
||||
{
|
||||
$this->chat = $chat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Torrent Moderation Panel
|
||||
*
|
||||
@@ -54,7 +65,26 @@ class ModerationController extends Controller
|
||||
*/
|
||||
public function approve($slug, $id)
|
||||
{
|
||||
TorrentHelper::approveHelper($slug, $id);
|
||||
$torrent = Torrent::withAnyStatus()->where('id', '=', $id)->where('slug', '=', $slug)->first();
|
||||
|
||||
$appurl = config('app.url');
|
||||
$user = $torrent->user;
|
||||
$user_id = $user->id;
|
||||
$username = $user->username;
|
||||
$anon = $torrent->anon;
|
||||
|
||||
// Announce To Shoutbox
|
||||
if ($anon == 0) {
|
||||
$this->chat->systemMessage(
|
||||
"User [url={$appurl}/" . $username . "." . $user_id . "]" . $username . "[/url] has uploaded [url={$appurl}/torrents/" . $torrent->slug . "." . $torrent->id . "]" . $torrent->name . "[/url] grab it now! :slight_smile:"
|
||||
);
|
||||
} else {
|
||||
$this->chat->systemMessage(
|
||||
"An anonymous user has uploaded [url={$appurl}/torrents/" . $torrent->slug . "." . $torrent->id . "]" . $torrent->name . "[/url] grab it now! :slight_smile:"
|
||||
);
|
||||
}
|
||||
|
||||
TorrentHelper::approveHelper($torrent->slug, $torrent->id);
|
||||
|
||||
return redirect()->route('moderation')
|
||||
->with(Toastr::success('Torrent Approved', 'Yay!', ['options']));
|
||||
|
||||
@@ -755,7 +755,25 @@ class TorrentController extends Controller
|
||||
|
||||
// check for trusted user and update torrent
|
||||
if ($user->group->is_trusted) {
|
||||
$appurl = config('app.url');
|
||||
$user = $torrent->user;
|
||||
$user_id = $user->id;
|
||||
$username = $user->username;
|
||||
$anon = $torrent->anon;
|
||||
|
||||
// Announce To Shoutbox
|
||||
if ($anon == 0) {
|
||||
$this->chat->systemMessage(
|
||||
"User [url={$appurl}/" . $username . "." . $user_id . "]" . $username . "[/url] has uploaded [url={$appurl}/torrents/" . $torrent->slug . "." . $torrent->id . "]" . $torrent->name . "[/url] grab it now! :slight_smile:"
|
||||
);
|
||||
} else {
|
||||
$this->chat->systemMessage(
|
||||
"An anonymous user has uploaded [url={$appurl}/torrents/" . $torrent->slug . "." . $torrent->id . "]" . $torrent->name . "[/url] grab it now! :slight_smile:"
|
||||
);
|
||||
}
|
||||
|
||||
TorrentHelper::approveHelper($torrent->slug, $torrent->id);
|
||||
|
||||
\LogActivity::addToLog("Member {$user->username} has uploaded torrent, ID: {$torrent->id} NAME: {$torrent->name} . \nThis torrent has been auto approved by the System.");
|
||||
} else {
|
||||
\LogActivity::addToLog("Member {$user->username} has uploaded torrent, ID: {$torrent->id} NAME: {$torrent->name} . \nThis torrent is pending approval from satff.");
|
||||
|
||||
Reference in New Issue
Block a user