mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Merge pull request #1551 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
54b3ab489b
4 changed files with 63 additions and 25 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use DB;
|
||||
use App\Jobs\ImageOptimizePipeline\ImageOptimize;
|
||||
use App\Media;
|
||||
use Illuminate\Console\Command;
|
||||
|
@ -39,9 +40,19 @@ class CatchUnoptimizedMedia extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$medias = Media::whereNotNull('status_id')->whereNull('processed_at')->take(250)->get();
|
||||
foreach ($medias as $media) {
|
||||
ImageOptimize::dispatch($media);
|
||||
}
|
||||
DB::transaction(function() {
|
||||
Media::whereNull('processed_at')
|
||||
->whereNotNull('status_id')
|
||||
->whereNotNull('media_path')
|
||||
->whereIn('mime', [
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
])
|
||||
->chunk(50, function($medias) {
|
||||
foreach ($medias as $media) {
|
||||
ImageOptimize::dispatch($media);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -388,7 +388,10 @@ class Helpers {
|
|||
|
||||
if($local == true) {
|
||||
$id = last(explode('/', $url));
|
||||
return Profile::whereUsername($id)->firstOrFail();
|
||||
return Profile::whereNull('status')
|
||||
->whereNull('domain')
|
||||
->whereUsername($id)
|
||||
->firstOrFail();
|
||||
}
|
||||
$res = self::fetchProfileFromUrl($url);
|
||||
if(isset($res['id']) == false) {
|
||||
|
|
|
@ -15,6 +15,7 @@ use App\{
|
|||
use Carbon\Carbon;
|
||||
use App\Util\ActivityPub\Helpers;
|
||||
use App\Jobs\LikePipeline\LikePipeline;
|
||||
use App\Jobs\FollowPipeline\FollowPipeline;
|
||||
|
||||
use App\Util\ActivityPub\Validator\{
|
||||
Accept,
|
||||
|
@ -243,28 +244,40 @@ class Inbox
|
|||
|
||||
public function handleAcceptActivity()
|
||||
{
|
||||
|
||||
$actor = $this->payload['actor'];
|
||||
$obj = $this->payload['object'];
|
||||
switch ($obj['type']) {
|
||||
case 'Follow':
|
||||
$accept = [
|
||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||
'id' => $target->permalink().'#accepts/follows/' . $follower->id,
|
||||
'type' => 'Accept',
|
||||
'actor' => $target->permalink(),
|
||||
'object' => [
|
||||
'id' => $actor->permalink('#follows/'.$target->id),
|
||||
'type' => 'Follow',
|
||||
'actor' => $actor->permalink(),
|
||||
'object' => $target->permalink()
|
||||
]
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
$obj = $this->payload['object']['object'];
|
||||
$type = $this->payload['object']['type'];
|
||||
|
||||
if($type !== 'Follow') {
|
||||
return;
|
||||
}
|
||||
|
||||
$actor = Helpers::validateUrl($actor);
|
||||
$target = Helpers::validateLocalUrl($obj);
|
||||
|
||||
if(!$actor || !$target) {
|
||||
return;
|
||||
}
|
||||
$actor = Helpers::profileFetch($actor);
|
||||
$target = Helpers::profileFetch($target);
|
||||
|
||||
$request = FollowRequest::whereFollowerId($actor->id)
|
||||
->whereFollowingId($target->id)
|
||||
->whereIsRejected(false)
|
||||
->first();
|
||||
|
||||
if(!$request) {
|
||||
return;
|
||||
}
|
||||
|
||||
$follower = new Follower();
|
||||
$follower->profile_id = $actor->id;
|
||||
$follower->following_id = $target->id;
|
||||
$follower->save();
|
||||
FollowPipeline::dispatch($follower);
|
||||
|
||||
$request->delete();
|
||||
}
|
||||
|
||||
public function handleDeleteActivity()
|
||||
|
|
|
@ -8,6 +8,17 @@
|
|||
<div class="text-center">
|
||||
<h1>Collection</h1>
|
||||
<h4 class="text-muted">{{$collection->title}}</h4>
|
||||
@auth
|
||||
@if($collection->profile_id == Auth::user()->profile_id)
|
||||
<div class="text-right">
|
||||
<form method="post" action="/api/local/collection/{{$collection->id}}">
|
||||
@csrf
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<button type="submit" class="btn btn-outline-danger font-weight-bold btn-sm py-1">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
@endauth
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
|
|
Loading…
Reference in a new issue