mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update view entity encoding
This commit is contained in:
parent
4e51fbd5eb
commit
231884c770
4 changed files with 42 additions and 12 deletions
|
@ -34,8 +34,8 @@ class CommentController extends Controller
|
||||||
|
|
||||||
$reply = new Status();
|
$reply = new Status();
|
||||||
$reply->profile_id = $profile->id;
|
$reply->profile_id = $profile->id;
|
||||||
$reply->caption = $comment;
|
$reply->caption = e(strip_tags($comment));
|
||||||
$reply->rendered = e($comment);
|
$reply->rendered = $comment;
|
||||||
$reply->in_reply_to_id = $status->id;
|
$reply->in_reply_to_id = $status->id;
|
||||||
$reply->in_reply_to_profile_id = $status->profile_id;
|
$reply->in_reply_to_profile_id = $status->profile_id;
|
||||||
$reply->save();
|
$reply->save();
|
||||||
|
|
|
@ -47,7 +47,7 @@ class StatusController extends Controller
|
||||||
|
|
||||||
$status = new Status;
|
$status = new Status;
|
||||||
$status->profile_id = $profile->id;
|
$status->profile_id = $profile->id;
|
||||||
$status->caption = $request->caption;
|
$status->caption = strip_tags($request->caption);
|
||||||
$status->is_nsfw = $cw;
|
$status->is_nsfw = $cw;
|
||||||
|
|
||||||
$status->save();
|
$status->save();
|
||||||
|
|
|
@ -16,17 +16,46 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-8 status-photo px-0">
|
<div class="col-12 col-md-8 status-photo px-0">
|
||||||
@if($status->is_nsfw)
|
@if($status->is_nsfw && $status->media_count == 1)
|
||||||
<details class="details-animated">
|
<details class="details-animated">
|
||||||
<p>
|
<p>
|
||||||
<summary>NSFW / Hidden Image</summary>
|
<summary>NSFW / Hidden Image</summary>
|
||||||
<a class="max-hide-overflow" href="{{$status->url()}}">
|
<a class="max-hide-overflow {{$status->firstMedia()->filter_class}}" href="{{$status->url()}}">
|
||||||
<img class="card-img-top" src="{{$status->mediaUrl()}}">
|
<img class="card-img-top" src="{{$status->mediaUrl()}}">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</details>
|
</details>
|
||||||
@else
|
@elseif(!$status->is_nsfw && $status->media_count == 1)
|
||||||
<img src="{{$status->mediaUrl()}}" width="100%">
|
<div class="{{$status->firstMedia()->filter_class}}">
|
||||||
|
<img src="{{$status->mediaUrl()}}" width="100%">
|
||||||
|
</div>
|
||||||
|
@elseif($status->is_nsfw && $status->media_count > 1)
|
||||||
|
|
||||||
|
@elseif(!$status->is_nsfw && $status->media_count > 1)
|
||||||
|
<div id="photoCarousel" class="carousel slide carousel-fade" data-ride="carousel">
|
||||||
|
<ol class="carousel-indicators">
|
||||||
|
@for($i = 0; $i < $status->media_count; $i++)
|
||||||
|
<li data-target="#photoCarousel" data-slide-to="{{$i}}" class="{{$i == 0 ? 'active' : ''}}"></li>
|
||||||
|
@endfor
|
||||||
|
</ol>
|
||||||
|
<div class="carousel-inner">
|
||||||
|
@foreach($status->media()->orderBy('order')->get() as $media)
|
||||||
|
<div class="carousel-item {{$loop->iteration == 1 ? 'active' : ''}}">
|
||||||
|
<figure class="{{$media->filter_class}}">
|
||||||
|
<img class="d-block w-100" src="{{$media->url()}}" alt="{{$status->caption}}">
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
<a class="carousel-control-prev" href="#photoCarousel" role="button" data-slide="prev">
|
||||||
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Previous</span>
|
||||||
|
</a>
|
||||||
|
<a class="carousel-control-next" href="#photoCarousel" role="button" data-slide="next">
|
||||||
|
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-4 px-0 d-flex flex-column border-left border-md-left-0">
|
<div class="col-12 col-md-4 px-0 d-flex flex-column border-left border-md-left-0">
|
||||||
|
@ -51,7 +80,7 @@
|
||||||
@foreach($status->comments->reverse()->take(10) as $item)
|
@foreach($status->comments->reverse()->take(10) as $item)
|
||||||
<p class="mb-0">
|
<p class="mb-0">
|
||||||
<span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="{{$item->profile->url()}}">{{$item->profile->username}}</a></bdi></span>
|
<span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="{{$item->profile->url()}}">{{$item->profile->username}}</a></bdi></span>
|
||||||
<span class="comment-text">{!!$item->rendered!!} <a href="{{$item->url()}}" class="text-dark small font-weight-bold float-right">{{$item->created_at->diffForHumans(null, true, true ,true)}}</a></span>
|
<span class="comment-text">{!! $item->rendered ?? e($item->caption) !!} <a href="{{$item->url()}}" class="text-dark small font-weight-bold float-right">{{$item->created_at->diffForHumans(null, true, true ,true)}}</a></span>
|
||||||
</p>
|
</p>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<a class="dropdown-item" href="#">Embed</a>
|
<a class="dropdown-item" href="#">Embed</a>
|
||||||
@if(Auth::check())
|
@if(Auth::check())
|
||||||
@if(Auth::user()->profile->id === $item->profile->id || Auth::user()->is_admin == true)
|
@if(Auth::user()->profile->id === $item->profile->id || Auth::user()->is_admin == true)
|
||||||
|
<a class="dropdown-item" href="{{$item->editUrl()}}">Edit</a>
|
||||||
<form method="post" action="/i/delete">
|
<form method="post" action="/i/delete">
|
||||||
@csrf
|
@csrf
|
||||||
<input type="hidden" name="type" value="post">
|
<input type="hidden" name="type" value="post">
|
||||||
|
@ -32,13 +33,13 @@
|
||||||
<details class="details-animated">
|
<details class="details-animated">
|
||||||
<p>
|
<p>
|
||||||
<summary>NSFW / Hidden Image</summary>
|
<summary>NSFW / Hidden Image</summary>
|
||||||
<a class="max-hide-overflow" href="{{$item->url()}}">
|
<a class="max-hide-overflow {{$item->firstMedia()->filter_class}}" href="{{$item->url()}}">
|
||||||
<img class="card-img-top" src="{{$item->mediaUrl()}}">
|
<img class="card-img-top" src="{{$item->mediaUrl()}}">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</details>
|
</details>
|
||||||
@else
|
@else
|
||||||
<a class="max-hide-overflow" href="{{$item->url()}}">
|
<a class="max-hide-overflow {{$item->firstMedia()->filter_class}}" href="{{$item->url()}}">
|
||||||
<img class="card-img-top" src="{{$item->mediaUrl()}}">
|
<img class="card-img-top" src="{{$item->mediaUrl()}}">
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
|
@ -84,7 +85,7 @@
|
||||||
<a class="text-dark" href="{{$status->profile->url()}}">{{$status->profile->username}}</a>
|
<a class="text-dark" href="{{$status->profile->url()}}">{{$status->profile->username}}</a>
|
||||||
</bdi>
|
</bdi>
|
||||||
</span>
|
</span>
|
||||||
<span class="comment-text">{!!$status->rendered!!}</span>
|
<span class="comment-text">{!! $item->rendered ?? e($item->caption) !!}</span>
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
<a href="{{$status->url()}}" class="text-dark small font-weight-bold">
|
<a href="{{$status->url()}}" class="text-dark small font-weight-bold">
|
||||||
{{$status->created_at->diffForHumans(null, true, true, true)}}
|
{{$status->created_at->diffForHumans(null, true, true, true)}}
|
||||||
|
@ -95,7 +96,7 @@
|
||||||
@foreach($item->comments->reverse()->take(3) as $comment)
|
@foreach($item->comments->reverse()->take(3) as $comment)
|
||||||
<p class="mb-0">
|
<p class="mb-0">
|
||||||
<span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="{{$comment->profile->url()}}">{{$comment->profile->username}}</a></bdi></span>
|
<span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="{{$comment->profile->url()}}">{{$comment->profile->username}}</a></bdi></span>
|
||||||
<span class="comment-text">{{ str_limit($comment->caption, 125) }}</span>
|
<span class="comment-text">{!! str_limit($item->rendered ?? e($item->caption), 150) !!}</span>
|
||||||
</p>
|
</p>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
Loading…
Reference in a new issue