Allow to process report more than once
This commit is contained in:
parent
aec1c1312e
commit
9c0c72c166
|
|
@ -89,14 +89,11 @@ class ReportController extends Controller
|
|||
]);
|
||||
$report = Report::find($data['id']);
|
||||
|
||||
if ($report->status != Report::PENDING) {
|
||||
return json(trans('admin.report-reviewed'), 1);
|
||||
}
|
||||
|
||||
if ($data['action'] == 'reject') {
|
||||
if (
|
||||
$report->informer &&
|
||||
($score = option('reporter_score_modification', 0)) > 0
|
||||
($score = option('reporter_score_modification', 0)) > 0 &&
|
||||
$report->status == Report::PENDING
|
||||
) {
|
||||
$report->informer->score -= $score;
|
||||
$report->informer->save();
|
||||
|
|
@ -120,15 +117,17 @@ class ReportController extends Controller
|
|||
break;
|
||||
}
|
||||
|
||||
if ($report->status == Report::PENDING) {
|
||||
if (($score = option('reporter_score_modification', 0)) < 0) {
|
||||
$report->informer->score -= $score;
|
||||
}
|
||||
$report->informer->score += option('reporter_reward_score', 0);
|
||||
$report->informer->save();
|
||||
}
|
||||
|
||||
$report->status = Report::RESOLVED;
|
||||
$report->save();
|
||||
|
||||
if (($score = option('reporter_score_modification', 0)) < 0) {
|
||||
$report->informer->score -= $score;
|
||||
}
|
||||
$report->informer->score += option('reporter_reward_score', 0);
|
||||
$report->informer->save();
|
||||
|
||||
return json(trans('general.op-success'), 0, ['status' => Report::RESOLVED]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
## Tweaked
|
||||
|
||||
- Preview the player automatically if a user has only one player.
|
||||
- Allowed to process report more than once.
|
||||
|
||||
## Fixed
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
## 调整
|
||||
|
||||
- 当用户只有一个角色时,角色页面会自动预览该角色
|
||||
- 允许多次处理同一条举报
|
||||
|
||||
## 修复
|
||||
|
||||
|
|
|
|||
|
|
@ -144,12 +144,9 @@ class ReportControllerTest extends TestCase
|
|||
$this->postJson('/admin/reports', ['id' => $report->id, 'action' => 'a'])
|
||||
->assertJsonValidationErrors('action');
|
||||
|
||||
// Only process pending report
|
||||
// Allow to process again
|
||||
$this->postJson('/admin/reports', ['id' => $report->id, 'action' => 'reject'])
|
||||
->assertJson([
|
||||
'code' => 1,
|
||||
'message' => trans('admin.report-reviewed'),
|
||||
]);
|
||||
->assertJson(['code' => 0]);
|
||||
|
||||
// Reject
|
||||
$report->status = Report::PENDING;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user