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