mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-11 06:30:46 +00:00
Merge pull request #2144 from pixelfed/staging
Update Timeline component, fix mod tools
This commit is contained in:
commit
ce9b5b7ff8
5 changed files with 122 additions and 147 deletions
|
@ -13,6 +13,7 @@
|
||||||
- Updated RemotePost component, fix missing like button on comments ([7ef90565](https://github.com/pixelfed/pixelfed/commit/7ef90565))
|
- Updated RemotePost component, fix missing like button on comments ([7ef90565](https://github.com/pixelfed/pixelfed/commit/7ef90565))
|
||||||
- Updated PublicApiControllers, fix block/mutes filtering on public timeline ([08383dd4](https://github.com/pixelfed/pixelfed/commit/08383dd4))
|
- Updated PublicApiControllers, fix block/mutes filtering on public timeline ([08383dd4](https://github.com/pixelfed/pixelfed/commit/08383dd4))
|
||||||
- Updated FixUsernames command, fixes remote username search ([0f943f67](https://github.com/pixelfed/pixelfed/commit/0f943f67))
|
- Updated FixUsernames command, fixes remote username search ([0f943f67](https://github.com/pixelfed/pixelfed/commit/0f943f67))
|
||||||
|
- Updated Timeline component, fix mod tools ([b1d5eb05](https://github.com/pixelfed/pixelfed/commit/b1d5eb05))
|
||||||
|
|
||||||
|
|
||||||
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
|
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
|
||||||
|
|
|
@ -30,6 +30,8 @@ use League\Fractal\Serializer\ArraySerializer;
|
||||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use App\Services\ModLogService;
|
||||||
|
use App\Services\PublicTimelineService;
|
||||||
|
|
||||||
class InternalApiController extends Controller
|
class InternalApiController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -161,24 +163,23 @@ class InternalApiController extends Controller
|
||||||
|
|
||||||
public function modAction(Request $request)
|
public function modAction(Request $request)
|
||||||
{
|
{
|
||||||
abort_unless(Auth::user()->is_admin, 403);
|
abort_unless(Auth::user()->is_admin, 400);
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'action' => [
|
'action' => [
|
||||||
'required',
|
'required',
|
||||||
'string',
|
'string',
|
||||||
Rule::in([
|
Rule::in([
|
||||||
'autocw',
|
'addcw',
|
||||||
'noautolink',
|
'remcw',
|
||||||
'unlisted',
|
'unlist'
|
||||||
'disable',
|
|
||||||
'suspend'
|
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
'item_id' => 'required|integer|min:1',
|
'item_id' => 'required|integer|min:1',
|
||||||
'item_type' => [
|
'item_type' => [
|
||||||
'required',
|
'required',
|
||||||
'string',
|
'string',
|
||||||
Rule::in(['status'])
|
Rule::in(['profile', 'status'])
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -187,48 +188,61 @@ class InternalApiController extends Controller
|
||||||
$item_type = $request->input('item_type');
|
$item_type = $request->input('item_type');
|
||||||
|
|
||||||
switch($action) {
|
switch($action) {
|
||||||
case 'autocw':
|
case 'addcw':
|
||||||
$profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null;
|
$status = Status::findOrFail($item_id);
|
||||||
$profile->cw = true;
|
$status->is_nsfw = true;
|
||||||
$profile->save();
|
$status->save();
|
||||||
|
ModLogService::boot()
|
||||||
|
->user(Auth::user())
|
||||||
|
->objectUid($status->profile->user_id)
|
||||||
|
->objectId($status->id)
|
||||||
|
->objectType('App\Status::class')
|
||||||
|
->action('admin.status.moderate')
|
||||||
|
->metadata([
|
||||||
|
'action' => 'cw',
|
||||||
|
'message' => 'Success!'
|
||||||
|
])
|
||||||
|
->accessLevel('admin')
|
||||||
|
->save();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'noautolink':
|
case 'remcw':
|
||||||
$profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null;
|
$status = Status::findOrFail($item_id);
|
||||||
$profile->no_autolink = true;
|
$status->is_nsfw = false;
|
||||||
$profile->save();
|
$status->save();
|
||||||
|
ModLogService::boot()
|
||||||
|
->user(Auth::user())
|
||||||
|
->objectUid($status->profile->user_id)
|
||||||
|
->objectId($status->id)
|
||||||
|
->objectType('App\Status::class')
|
||||||
|
->action('admin.status.moderate')
|
||||||
|
->metadata([
|
||||||
|
'action' => 'remove_cw',
|
||||||
|
'message' => 'Success!'
|
||||||
|
])
|
||||||
|
->accessLevel('admin')
|
||||||
|
->save();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unlisted':
|
case 'unlist':
|
||||||
$profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null;
|
$status = Status::whereScope('public')->findOrFail($item_id);
|
||||||
$profile->unlisted = true;
|
$status->scope = $status->visibility = 'unlisted';
|
||||||
$profile->save();
|
$status->save();
|
||||||
break;
|
PublicTimelineService::del($status->id);
|
||||||
|
ModLogService::boot()
|
||||||
case 'disable':
|
->user(Auth::user())
|
||||||
$profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null;
|
->objectUid($status->profile->user_id)
|
||||||
$user = $profile->user;
|
->objectId($status->id)
|
||||||
$profile->status = 'disabled';
|
->objectType('App\Status::class')
|
||||||
$user->status = 'disabled';
|
->action('admin.status.moderate')
|
||||||
$profile->save();
|
->metadata([
|
||||||
$user->save();
|
'action' => 'unlist',
|
||||||
break;
|
'message' => 'Success!'
|
||||||
|
])
|
||||||
|
->accessLevel('admin')
|
||||||
case 'suspend':
|
->save();
|
||||||
$profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null;
|
|
||||||
$user = $profile->user;
|
|
||||||
$profile->status = 'suspended';
|
|
||||||
$user->status = 'suspended';
|
|
||||||
$profile->save();
|
|
||||||
$user->save();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
# code...
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Cache::forget('profiles:private');
|
|
||||||
return ['msg' => 200];
|
return ['msg' => 200];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
public/js/timeline.js
vendored
BIN
public/js/timeline.js
vendored
Binary file not shown.
Binary file not shown.
|
@ -399,7 +399,8 @@
|
||||||
body-class="list-group-flush p-0 rounded">
|
body-class="list-group-flush p-0 rounded">
|
||||||
<div class="list-group text-center">
|
<div class="list-group text-center">
|
||||||
<div class="list-group-item rounded cursor-pointer" @click="moderatePost(ctxMenuStatus, 'unlist')">Unlist from Timelines</div>
|
<div class="list-group-item rounded cursor-pointer" @click="moderatePost(ctxMenuStatus, 'unlist')">Unlist from Timelines</div>
|
||||||
<div class="list-group-item rounded cursor-pointer" @click="">Add Content Warning</div>
|
<div v-if="ctxMenuStatus.sensitive" class="list-group-item rounded cursor-pointer" @click="moderatePost(ctxMenuStatus, 'remcw')">Remove Content Warning</div>
|
||||||
|
<div v-else class="list-group-item rounded cursor-pointer" @click="moderatePost(ctxMenuStatus, 'addcw')">Add Content Warning</div>
|
||||||
<div class="list-group-item rounded cursor-pointer text-lighter" @click="ctxModMenuClose()">Cancel</div>
|
<div class="list-group-item rounded cursor-pointer text-lighter" @click="ctxModMenuClose()">Cancel</div>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
|
@ -929,9 +930,11 @@
|
||||||
|
|
||||||
moderatePost(status, action, $event) {
|
moderatePost(status, action, $event) {
|
||||||
let username = status.account.username;
|
let username = status.account.username;
|
||||||
|
let msg = '';
|
||||||
|
let self = this;
|
||||||
switch(action) {
|
switch(action) {
|
||||||
case 'autocw':
|
case 'addcw':
|
||||||
let msg = 'Are you sure you want to enforce CW for ' + username + ' ?';
|
msg = 'Are you sure you want to add a content warning to this post?';
|
||||||
swal({
|
swal({
|
||||||
title: 'Confirm',
|
title: 'Confirm',
|
||||||
text: msg,
|
text: msg,
|
||||||
|
@ -945,20 +948,23 @@
|
||||||
item_id: status.id,
|
item_id: status.id,
|
||||||
item_type: 'status'
|
item_type: 'status'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
swal('Success', 'Successfully enforced CW for ' + username, 'success');
|
swal('Success', 'Successfully added content warning', 'success');
|
||||||
|
status.sensitive = true;
|
||||||
|
self.ctxModMenuClose();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
swal(
|
swal(
|
||||||
'Error',
|
'Error',
|
||||||
'Something went wrong, please try again later.',
|
'Something went wrong, please try again later.',
|
||||||
'error'
|
'error'
|
||||||
);
|
);
|
||||||
|
self.ctxModMenuClose();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'noautolink':
|
case 'remcw':
|
||||||
msg = 'Are you sure you want to disable auto linking for ' + username + ' ?';
|
msg = 'Are you sure you want to remove the content warning on this post?';
|
||||||
swal({
|
swal({
|
||||||
title: 'Confirm',
|
title: 'Confirm',
|
||||||
text: msg,
|
text: msg,
|
||||||
|
@ -972,20 +978,23 @@
|
||||||
item_id: status.id,
|
item_id: status.id,
|
||||||
item_type: 'status'
|
item_type: 'status'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
swal('Success', 'Successfully disabled autolinking for ' + username, 'success');
|
swal('Success', 'Successfully added content warning', 'success');
|
||||||
|
status.sensitive = false;
|
||||||
|
self.ctxModMenuClose();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
swal(
|
swal(
|
||||||
'Error',
|
'Error',
|
||||||
'Something went wrong, please try again later.',
|
'Something went wrong, please try again later.',
|
||||||
'error'
|
'error'
|
||||||
);
|
);
|
||||||
|
self.ctxModMenuClose();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unlisted':
|
case 'unlist':
|
||||||
msg = 'Are you sure you want to unlist from timelines for ' + username + ' ?';
|
msg = 'Are you sure you want to unlist this post?';
|
||||||
swal({
|
swal({
|
||||||
title: 'Confirm',
|
title: 'Confirm',
|
||||||
text: msg,
|
text: msg,
|
||||||
|
@ -999,62 +1008,13 @@
|
||||||
item_id: status.id,
|
item_id: status.id,
|
||||||
item_type: 'status'
|
item_type: 'status'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
swal('Success', 'Successfully unlisted for ' + username, 'success');
|
this.feed = this.feed.filter(f => {
|
||||||
}).catch(err => {
|
return f.id != status.id;
|
||||||
swal(
|
});
|
||||||
'Error',
|
swal('Success', 'Successfully unlisted post', 'success');
|
||||||
'Something went wrong, please try again later.',
|
self.ctxModMenuClose();
|
||||||
'error'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'disable':
|
|
||||||
msg = 'Are you sure you want to disable ' + username + '’s account ?';
|
|
||||||
swal({
|
|
||||||
title: 'Confirm',
|
|
||||||
text: msg,
|
|
||||||
icon: 'warning',
|
|
||||||
buttons: true,
|
|
||||||
dangerMode: true
|
|
||||||
}).then(res => {
|
|
||||||
if(res) {
|
|
||||||
axios.post('/api/v2/moderator/action', {
|
|
||||||
action: action,
|
|
||||||
item_id: status.id,
|
|
||||||
item_type: 'status'
|
|
||||||
}).then(res => {
|
|
||||||
swal('Success', 'Successfully disabled ' + username + '’s account', 'success');
|
|
||||||
}).catch(err => {
|
|
||||||
swal(
|
|
||||||
'Error',
|
|
||||||
'Something went wrong, please try again later.',
|
|
||||||
'error'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'suspend':
|
|
||||||
msg = 'Are you sure you want to suspend ' + username + '’s account ?';
|
|
||||||
swal({
|
|
||||||
title: 'Confirm',
|
|
||||||
text: msg,
|
|
||||||
icon: 'warning',
|
|
||||||
buttons: true,
|
|
||||||
dangerMode: true
|
|
||||||
}).then(res => {
|
|
||||||
if(res) {
|
|
||||||
axios.post('/api/v2/moderator/action', {
|
|
||||||
action: action,
|
|
||||||
item_id: status.id,
|
|
||||||
item_type: 'status'
|
|
||||||
}).then(res => {
|
|
||||||
swal('Success', 'Successfully suspend ' + username + '’s account', 'success');
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
self.ctxModMenuClose();
|
||||||
swal(
|
swal(
|
||||||
'Error',
|
'Error',
|
||||||
'Something went wrong, please try again later.',
|
'Something went wrong, please try again later.',
|
||||||
|
|
Loading…
Reference in a new issue