mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update Timeline component, fix mod tools
This commit is contained in:
parent
9b37c439f7
commit
b1d5eb0556
2 changed files with 66 additions and 105 deletions
|
@ -31,6 +31,7 @@ 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\ModLogService;
|
||||||
|
use App\Services\PublicTimelineService;
|
||||||
|
|
||||||
class InternalApiController extends Controller
|
class InternalApiController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -227,7 +228,7 @@ class InternalApiController extends Controller
|
||||||
$status = Status::whereScope('public')->findOrFail($item_id);
|
$status = Status::whereScope('public')->findOrFail($item_id);
|
||||||
$status->scope = $status->visibility = 'unlisted';
|
$status->scope = $status->visibility = 'unlisted';
|
||||||
$status->save();
|
$status->save();
|
||||||
App\Services\PublicTimelineService::del($status->id);
|
PublicTimelineService::del($status->id);
|
||||||
ModLogService::boot()
|
ModLogService::boot()
|
||||||
->user(Auth::user())
|
->user(Auth::user())
|
||||||
->objectUid($status->profile->user_id)
|
->objectUid($status->profile->user_id)
|
||||||
|
|
|
@ -399,55 +399,56 @@
|
||||||
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>
|
||||||
<b-modal ref="ctxShareModal"
|
<b-modal ref="ctxShareModal"
|
||||||
id="ctx-share-modal"
|
id="ctx-share-modal"
|
||||||
title="Share"
|
title="Share"
|
||||||
hide-footer
|
hide-footer
|
||||||
centered
|
centered
|
||||||
rounded
|
rounded
|
||||||
size="sm"
|
size="sm"
|
||||||
body-class="list-group-flush p-0 rounded text-center">
|
body-class="list-group-flush p-0 rounded text-center">
|
||||||
<div class="list-group-item rounded cursor-pointer border-top-0">Email</div>
|
<div class="list-group-item rounded cursor-pointer border-top-0">Email</div>
|
||||||
<div class="list-group-item rounded cursor-pointer">Facebook</div>
|
<div class="list-group-item rounded cursor-pointer">Facebook</div>
|
||||||
<div class="list-group-item rounded cursor-pointer">Mastodon</div>
|
<div class="list-group-item rounded cursor-pointer">Mastodon</div>
|
||||||
<div class="list-group-item rounded cursor-pointer">Pinterest</div>
|
<div class="list-group-item rounded cursor-pointer">Pinterest</div>
|
||||||
<div class="list-group-item rounded cursor-pointer">Pixelfed</div>
|
<div class="list-group-item rounded cursor-pointer">Pixelfed</div>
|
||||||
<div class="list-group-item rounded cursor-pointer">Twitter</div>
|
<div class="list-group-item rounded cursor-pointer">Twitter</div>
|
||||||
<div class="list-group-item rounded cursor-pointer">VK</div>
|
<div class="list-group-item rounded cursor-pointer">VK</div>
|
||||||
<div class="list-group-item rounded cursor-pointer text-lighter" @click="closeCtxShareMenu()">Cancel</div>
|
<div class="list-group-item rounded cursor-pointer text-lighter" @click="closeCtxShareMenu()">Cancel</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
<b-modal ref="ctxEmbedModal"
|
<b-modal ref="ctxEmbedModal"
|
||||||
id="ctx-embed-modal"
|
id="ctx-embed-modal"
|
||||||
hide-header
|
hide-header
|
||||||
hide-footer
|
hide-footer
|
||||||
centered
|
centered
|
||||||
rounded
|
rounded
|
||||||
size="md"
|
size="md"
|
||||||
body-class="p-2 rounded">
|
body-class="p-2 rounded">
|
||||||
<div>
|
<div>
|
||||||
<textarea class="form-control disabled" rows="1" style="border: 1px solid #efefef; font-size: 14px; line-height: 12px; height: 37px; margin: 0 0 7px; resize: none; white-space: nowrap;" v-model="ctxEmbedPayload"></textarea>
|
<textarea class="form-control disabled" rows="1" style="border: 1px solid #efefef; font-size: 14px; line-height: 12px; height: 37px; margin: 0 0 7px; resize: none; white-space: nowrap;" v-model="ctxEmbedPayload"></textarea>
|
||||||
<hr>
|
<hr>
|
||||||
<button :class="copiedEmbed ? 'btn btn-primary btn-block btn-sm py-1 font-weight-bold disabed': 'btn btn-primary btn-block btn-sm py-1 font-weight-bold'" @click="ctxCopyEmbed" :disabled="copiedEmbed">{{copiedEmbed ? 'Embed Code Copied!' : 'Copy Embed Code'}}</button>
|
<button :class="copiedEmbed ? 'btn btn-primary btn-block btn-sm py-1 font-weight-bold disabed': 'btn btn-primary btn-block btn-sm py-1 font-weight-bold'" @click="ctxCopyEmbed" :disabled="copiedEmbed">{{copiedEmbed ? 'Embed Code Copied!' : 'Copy Embed Code'}}</button>
|
||||||
<p class="mb-0 px-2 small text-muted">By using this embed, you agree to our <a href="/site/terms">Terms of Use</a></p>
|
<p class="mb-0 px-2 small text-muted">By using this embed, you agree to our <a href="/site/terms">Terms of Use</a></p>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
<b-modal
|
<b-modal
|
||||||
id="lightbox"
|
id="lightbox"
|
||||||
ref="lightboxModal"
|
ref="lightboxModal"
|
||||||
hide-header
|
hide-header
|
||||||
hide-footer
|
hide-footer
|
||||||
centered
|
centered
|
||||||
size="lg"
|
size="lg"
|
||||||
body-class="p-0"
|
body-class="p-0"
|
||||||
>
|
>
|
||||||
<div v-if="lightboxMedia" :class="lightboxMedia.filter_class" class="w-100 h-100">
|
<div v-if="lightboxMedia" :class="lightboxMedia.filter_class" class="w-100 h-100">
|
||||||
<img :src="lightboxMedia.url" style="max-height: 100%; max-width: 100%">
|
<img :src="lightboxMedia.url" style="max-height: 100%; max-width: 100%">
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
<b-modal ref="replyModal"
|
<b-modal ref="replyModal"
|
||||||
id="ctx-reply-modal"
|
id="ctx-reply-modal"
|
||||||
hide-footer
|
hide-footer
|
||||||
|
@ -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