This commit is contained in:
Daniel Supernault 2018-11-22 13:21:36 -07:00
parent 10cfb02a9e
commit 580bfd0bbe
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
8 changed files with 39 additions and 13 deletions

View file

@ -133,9 +133,12 @@ class StatusController extends Controller
if ($status->profile_id === Auth::user()->profile->id || Auth::user()->is_admin == true) {
StatusDelete::dispatch($status);
}
if($request->wantsJson()) {
return response()->json(['Status successfully deleted.']);
} else {
return redirect(Auth::user()->url());
}
}
public function storeShare(Request $request)
{

View file

@ -38,15 +38,12 @@ class StatusDelete implements ShouldQueue
public function handle()
{
$status = $this->status;
$this->unlinkRemoveMedia($status);
}
public function unlinkRemoveMedia($status)
{
if ($status->media()->count() == 0) {
return;
}
foreach ($status->media as $media) {
$thumbnail = storage_path("app/{$media->thumbnail_path}");
$photo = storage_path("app/{$media->media_path}");

Binary file not shown.

Binary file not shown.

View file

@ -115,3 +115,8 @@ $(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip()
});
});
const warningTitleCSS = 'color:red; font-size:60px; font-weight: bold; -webkit-text-stroke: 1px black;';
const warningDescCSS = 'font-size: 18px;';
console.log('%cStop!', warningTitleCSS);
console.log("%cThis is a browser feature intended for developers. If someone told you to copy and paste something here to enable a Pixelfed feature or \"hack\" someone's account, it is a scam and will give them access to your Pixelfed account.", warningDescCSS);

View file

@ -37,6 +37,7 @@
<b-dropdown-item class="font-weight-bold" :href="comment.account.url">Profile</b-dropdown-item>
<b-dropdown-divider></b-dropdown-divider>
<b-dropdown-item class="font-weight-bold" :href="'/i/report?type=post&id='+comment.id">Report</b-dropdown-item>
<b-dropdown-item class="font-weight-bold" v-on:click="deleteComment(comment.id, index)" v-if="comment.account.id == user.id">Delete</b-dropdown-item>
</b-dropdown>
</span>
</p>
@ -47,7 +48,7 @@
<script>
export default {
props: ['post-id', 'post-username'],
props: ['post-id', 'post-username', 'user'],
data() {
return {
results: {},
@ -67,6 +68,16 @@ export default {
embed(e) {
pixelfed.embed.build(e);
},
deleteComment(id, i) {
axios.post('/i/delete', {
type: 'comment',
item: id
}).then(res => {
this.results.splice(i, 1);
}).catch(err => {
swal('Something went wrong!', 'Please try again later', 'error');
});
},
l(e) {
let len = e.length;
if(len < 10) { return e; }

View file

@ -201,7 +201,7 @@
<span class="font-weight-bold pr-1">{{statusUsername}}</span>
<span class="comment-text"></span>
</p>
<post-comments :post-id="statusId" :post-username="statusUsername"></post-comments>
<post-comments :user="this.user" :post-id="statusId" :post-username="statusUsername"></post-comments>
</div>
</div>
<div class="card-body flex-grow-0 py-1">
@ -266,7 +266,7 @@
pixelfed.postComponent = {};
pixelfed.presenter = {
show: {
image: function(container, media) { console.log(234);
image: function(container, media) {
let wrapper = $('<div>');
wrapper.addClass(media[0]['filter_class']);
let el = $('<img>');
@ -345,9 +345,7 @@ export default {
},
showMuteBlock() {
let sid = this.status.account.id;
console.log('sid :' + sid);
let uid = this.user.id;
console.log('uid :' + uid);
if(sid != uid) {
$('.post-actions').removeClass('d-none');
}

View file

@ -26,7 +26,19 @@
<div class="media-body">
<h5 class="mt-0 font-weight-bold">{{$status->profile->username}}</h5>
<p class="mb-1">{!! $status->rendered !!}</p>
<p class="mb-0"><a href="{{$status->url()}}" class="text-muted">{{$status->created_at->diffForHumans()}}</a></p>
<div class="mb-0">
<a href="{{$status->url()}}" class="text-muted">
{{$status->created_at->diffForHumans()}}
</a>
@if(Auth::check() && $status->profile_id == Auth::user()->profile->id)
<form class="float-right" method="POST" action="/i/delete">
@csrf
<input type="hidden" name="item" value="{{$status->id}}">
<input type="hidden" name="type" value="status">
<button class="btn btn-outline-danger small font-weight-bold btn-sm py-1">Delete</button>
</form>
@endif
</div>
</div>
</div>
</div>