1
0
Fork 0
forked from mirror/pixelfed

Merge pull request #1125 from pixelfed/frontend-ui-refactor

Frontend ui refactor
This commit is contained in:
daniel 2019-04-04 23:20:39 -06:00 committed by GitHub
commit 5971a4144e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 34 deletions

View file

@ -2,7 +2,7 @@
namespace App\Util\ActivityPub;
use Cache, Purify, Storage, Request, Validator;
use DB, Cache, Purify, Storage, Request, Validator;
use App\{
Activity,
Follower,
@ -295,6 +295,7 @@ class Helpers {
$reply_to = null;
}
$ts = is_array($res['published']) ? $res['published'][0] : $res['published'];
$status = DB::transaction(function() use($profile, $res, $url, $ts, $reply_to, $cw, $scope) {
$status = new Status;
$status->profile_id = $profile->id;
$status->url = isset($res['url']) ? $res['url'] : $url;
@ -308,8 +309,10 @@ class Helpers {
$status->scope = $scope;
$status->visibility = $scope;
$status->save();
self::importNoteAttachment($res, $status);
return $status;
});
return $status;
}

View file

@ -122,13 +122,16 @@ class Inbox
{
$activity = $this->payload['object'];
$actor = $this->actorFirstOrCreate($this->payload['actor']);
if(!$actor || $actor->domain == null) {
return;
}
$inReplyTo = $activity['inReplyTo'];
$url = $activity['id'];
if(!Helpers::statusFirstOrFetch($url, true)) {
Helpers::statusFirstOrFetch($url, true);
return;
}
}
public function handleNoteCreate()
{
@ -139,7 +142,6 @@ class Inbox
}
if(Helpers::userInAudience($this->profile, $this->payload) == false) {
//Log::error('AP:inbox:userInAudience:false - Activity#'.$this->logger->id);
return;
}
@ -147,21 +149,8 @@ class Inbox
if(Status::whereUrl($url)->exists()) {
return;
}
$status = DB::transaction(function() use($activity, $actor, $url) {
$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);
Helpers::statusFirstOrFetch($url, false);
return;
}
public function handleFollowActivity()