mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 05:23:17 +00:00
Merge pull request #1125 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
5971a4144e
2 changed files with 26 additions and 34 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Util\ActivityPub;
|
namespace App\Util\ActivityPub;
|
||||||
|
|
||||||
use Cache, Purify, Storage, Request, Validator;
|
use DB, Cache, Purify, Storage, Request, Validator;
|
||||||
use App\{
|
use App\{
|
||||||
Activity,
|
Activity,
|
||||||
Follower,
|
Follower,
|
||||||
|
@ -295,21 +295,24 @@ class Helpers {
|
||||||
$reply_to = null;
|
$reply_to = null;
|
||||||
}
|
}
|
||||||
$ts = is_array($res['published']) ? $res['published'][0] : $res['published'];
|
$ts = is_array($res['published']) ? $res['published'][0] : $res['published'];
|
||||||
$status = new Status;
|
$status = DB::transaction(function() use($profile, $res, $url, $ts, $reply_to, $cw, $scope) {
|
||||||
$status->profile_id = $profile->id;
|
$status = new Status;
|
||||||
$status->url = isset($res['url']) ? $res['url'] : $url;
|
$status->profile_id = $profile->id;
|
||||||
$status->uri = isset($res['url']) ? $res['url'] : $url;
|
$status->url = isset($res['url']) ? $res['url'] : $url;
|
||||||
$status->caption = strip_tags($res['content']);
|
$status->uri = isset($res['url']) ? $res['url'] : $url;
|
||||||
$status->rendered = Purify::clean($res['content']);
|
$status->caption = strip_tags($res['content']);
|
||||||
$status->created_at = Carbon::parse($ts);
|
$status->rendered = Purify::clean($res['content']);
|
||||||
$status->in_reply_to_id = $reply_to;
|
$status->created_at = Carbon::parse($ts);
|
||||||
$status->local = false;
|
$status->in_reply_to_id = $reply_to;
|
||||||
$status->is_nsfw = $cw;
|
$status->local = false;
|
||||||
$status->scope = $scope;
|
$status->is_nsfw = $cw;
|
||||||
$status->visibility = $scope;
|
$status->scope = $scope;
|
||||||
$status->save();
|
$status->visibility = $scope;
|
||||||
|
$status->save();
|
||||||
|
self::importNoteAttachment($res, $status);
|
||||||
|
return $status;
|
||||||
|
});
|
||||||
|
|
||||||
self::importNoteAttachment($res, $status);
|
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,12 +122,15 @@ class Inbox
|
||||||
{
|
{
|
||||||
$activity = $this->payload['object'];
|
$activity = $this->payload['object'];
|
||||||
$actor = $this->actorFirstOrCreate($this->payload['actor']);
|
$actor = $this->actorFirstOrCreate($this->payload['actor']);
|
||||||
|
if(!$actor || $actor->domain == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$inReplyTo = $activity['inReplyTo'];
|
$inReplyTo = $activity['inReplyTo'];
|
||||||
$url = $activity['id'];
|
$url = $activity['id'];
|
||||||
|
|
||||||
if(!Helpers::statusFirstOrFetch($url, true)) {
|
Helpers::statusFirstOrFetch($url, true);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleNoteCreate()
|
public function handleNoteCreate()
|
||||||
|
@ -139,7 +142,6 @@ class Inbox
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Helpers::userInAudience($this->profile, $this->payload) == false) {
|
if(Helpers::userInAudience($this->profile, $this->payload) == false) {
|
||||||
//Log::error('AP:inbox:userInAudience:false - Activity#'.$this->logger->id);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,21 +149,8 @@ class Inbox
|
||||||
if(Status::whereUrl($url)->exists()) {
|
if(Status::whereUrl($url)->exists()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Helpers::statusFirstOrFetch($url, false);
|
||||||
$status = DB::transaction(function() use($activity, $actor, $url) {
|
return;
|
||||||
$caption = str_limit(strip_tags($activity['content']), config('pixelfed.max_caption_length'));
|
|
||||||
$status = new Status;
|
|
||||||
$status->profile_id = $actor->id;
|
|
||||||
$status->caption = strip_tags($caption);
|
|
||||||
$status->rendered = Purify::clean($caption);
|
|
||||||
$status->visibility = $status->scope = 'public';
|
|
||||||
$status->uri = $url;
|
|
||||||
$status->url = $url;
|
|
||||||
$status->save();
|
|
||||||
return $status;
|
|
||||||
});
|
|
||||||
|
|
||||||
Helpers::importNoteAttachment($activity, $status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleFollowActivity()
|
public function handleFollowActivity()
|
||||||
|
|
Loading…
Reference in a new issue