23
23
use App \Models \PrivateMessage ;
24
24
use App \Models \Scopes \ApprovedScope ;
25
25
use App \Models \Torrent ;
26
+ use App \Models \TorrentModerationMessage ;
26
27
use App \Repositories \ChatRepository ;
27
28
use App \Services \Unit3dAnnounce ;
28
29
@@ -52,11 +53,11 @@ public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\Vie
52
53
->where ('status ' , '= ' , Torrent::PENDING )
53
54
->get (),
54
55
'postponed ' => Torrent::withoutGlobalScope (ApprovedScope::class)
55
- ->with (['user.group ' , 'moderated.group ' , ' category ' , 'type ' , 'resolution ' ])
56
+ ->with (['user.group ' , 'category ' , 'type ' , 'resolution ' ])
56
57
->where ('status ' , '= ' , Torrent::POSTPONED )
57
58
->get (),
58
59
'rejected ' => Torrent::withoutGlobalScope (ApprovedScope::class)
59
- ->with (['user.group ' , 'moderated.group ' , ' category ' , 'type ' , 'resolution ' ])
60
+ ->with (['user.group ' , 'category ' , 'type ' , 'resolution ' ])
60
61
->where ('status ' , '= ' , Torrent::REJECTED )
61
62
->get (),
62
63
]);
@@ -108,14 +109,25 @@ public function update(UpdateModerationRequest $request, int $id): \Illuminate\H
108
109
109
110
TorrentHelper::approveHelper ($ id );
110
111
112
+ TorrentModerationMessage::create ([
113
+ 'moderated_by ' => $ staff ->id ,
114
+ 'torrent_id ' => $ torrent ->id ,
115
+ 'status ' => Torrent::APPROVED ,
116
+ ]);
117
+
111
118
return to_route ('staff.moderation.index ' )
112
119
->withSuccess ('Torrent Approved ' );
113
120
114
121
case Torrent::REJECTED :
115
122
$ torrent ->update ([
116
- 'status ' => Torrent::REJECTED ,
117
- 'moderated_at ' => now (),
123
+ 'status ' => Torrent::REJECTED ,
124
+ ]);
125
+
126
+ TorrentModerationMessage::create ([
118
127
'moderated_by ' => $ staff ->id ,
128
+ 'torrent_id ' => $ torrent ->id ,
129
+ 'status ' => Torrent::REJECTED ,
130
+ 'message ' => $ request ->message ,
119
131
]);
120
132
121
133
$ conversation = Conversation::create (['subject ' => 'Your upload, ' .$ torrent ->name .', has been rejected by ' .$ staff ->username ]);
@@ -137,9 +149,14 @@ public function update(UpdateModerationRequest $request, int $id): \Illuminate\H
137
149
138
150
case Torrent::POSTPONED :
139
151
$ torrent ->update ([
140
- 'status ' => Torrent::POSTPONED ,
141
- 'moderated_at ' => now (),
152
+ 'status ' => Torrent::POSTPONED ,
153
+ ]);
154
+
155
+ TorrentModerationMessage::create ([
142
156
'moderated_by ' => $ staff ->id ,
157
+ 'torrent_id ' => $ torrent ->id ,
158
+ 'status ' => Torrent::POSTPONED ,
159
+ 'message ' => $ request ->message ,
143
160
]);
144
161
145
162
$ conversation = Conversation::create (['subject ' => 'Your upload, ' .$ torrent ->name .', has been postponed by ' .$ staff ->username ]);
0 commit comments