Merge pull request #5356 from pixelfed/staging

Staging
This commit is contained in:
daniel 2024-11-19 04:08:47 -07:00 committed by GitHub
commit abe8298999
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 795 additions and 848 deletions

View file

@ -1,10 +1,14 @@
# Release Notes # Release Notes
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.12.3...dev) ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.12.3...dev)
### Updates
- Update AP helpers, reject statuses with invalid dates ([960f3849](https://github.com/pixelfed/pixelfed/commit/960f3849)) - Update AP helpers, reject statuses with invalid dates ([960f3849](https://github.com/pixelfed/pixelfed/commit/960f3849))
- Update DirectMessage API, fix broken threading ([044d410c](https://github.com/pixelfed/pixelfed/commit/044d410c)) - Update DirectMessage API, fix broken threading ([044d410c](https://github.com/pixelfed/pixelfed/commit/044d410c))
- Update Status caption render logic ([fb8dbb95](https://github.com/pixelfed/pixelfed/commit/fb8dbb95)) - Update Status caption render logic ([fb8dbb95](https://github.com/pixelfed/pixelfed/commit/fb8dbb95))
- Update ApiV1Controller, fix bookmark bug. Closes #5216 ([9f7cc52c](https://github.com/pixelfed/pixelfed/commit/9f7cc52c)) - Update ApiV1Controller, fix bookmark bug. Closes #5216 ([9f7cc52c](https://github.com/pixelfed/pixelfed/commit/9f7cc52c))
- Update Status caption logic, stop storing duplicate html caption in db and defer to cached StatusService rendering ([9eeb7b67](https://github.com/pixelfed/pixelfed/commit/9eeb7b67))
- Update AutolinkService, optimize lookups ([eac2c196](https://github.com/pixelfed/pixelfed/commit/eac2c196))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.12.4 (2024-11-08)](https://github.com/pixelfed/pixelfed/compare/v0.12.4...dev) ## [v0.12.4 (2024-11-08)](https://github.com/pixelfed/pixelfed/compare/v0.12.4...dev)

View file

@ -2,17 +2,16 @@
namespace App\Console\Commands; namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\ImportPost;
use App\Services\ImportService;
use App\Media; use App\Media;
use App\Models\ImportPost;
use App\Profile; use App\Profile;
use App\Status;
use Storage;
use App\Services\AccountService; use App\Services\AccountService;
use App\Services\ImportService;
use App\Services\MediaPathService; use App\Services\MediaPathService;
use App\Status;
use Illuminate\Console\Command;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use App\Util\Lexer\Autolink; use Storage;
class TransformImports extends Command class TransformImports extends Command
{ {
@ -52,6 +51,7 @@ class TransformImports extends Command
if (! $profile) { if (! $profile) {
$ip->skip_missing_media = true; $ip->skip_missing_media = true;
$ip->save(); $ip->save();
continue; continue;
} }
@ -66,6 +66,7 @@ class TransformImports extends Command
if ($exists == true) { if ($exists == true) {
$ip->skip_missing_media = true; $ip->skip_missing_media = true;
$ip->save(); $ip->save();
continue; continue;
} }
@ -73,6 +74,7 @@ class TransformImports extends Command
if (! $idk) { if (! $idk) {
$ip->skip_missing_media = true; $ip->skip_missing_media = true;
$ip->save(); $ip->save();
continue; continue;
} }
@ -81,6 +83,7 @@ class TransformImports extends Command
ImportService::getPostCount($profile->id, true); ImportService::getPostCount($profile->id, true);
$ip->skip_missing_media = true; $ip->skip_missing_media = true;
$ip->save(); $ip->save();
continue; continue;
} }
@ -96,6 +99,7 @@ class TransformImports extends Command
if ($missingMedia === true) { if ($missingMedia === true) {
$ip->skip_missing_media = true; $ip->skip_missing_media = true;
$ip->save(); $ip->save();
continue; continue;
} }
@ -103,7 +107,6 @@ class TransformImports extends Command
$status = new Status; $status = new Status;
$status->profile_id = $pid; $status->profile_id = $pid;
$status->caption = $caption; $status->caption = $caption;
$status->rendered = strlen(trim($caption)) ? Autolink::create()->autolink($ip->caption) : null;
$status->type = $ip->post_type; $status->type = $ip->post_type;
$status->scope = 'unlisted'; $status->scope = 'unlisted';
@ -120,6 +123,7 @@ class TransformImports extends Command
if (! Storage::exists($og)) { if (! Storage::exists($og)) {
$ip->skip_missing_media = true; $ip->skip_missing_media = true;
$ip->save(); $ip->save();
continue; continue;
} }
$size = Storage::size($og); $size = Storage::size($og);

View file

@ -3490,8 +3490,7 @@ class ApiV1Controller extends Controller
return []; return [];
} }
$content = strip_tags($request->input('status')); $content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : null;
$rendered = Autolink::create()->autolink($content);
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false); $cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null; $spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;
@ -3505,7 +3504,6 @@ class ApiV1Controller extends Controller
$status = new Status; $status = new Status;
$status->caption = $content; $status->caption = $content;
$status->rendered = $rendered;
$status->scope = $visibility; $status->scope = $visibility;
$status->visibility = $visibility; $status->visibility = $visibility;
$status->profile_id = $user->profile_id; $status->profile_id = $user->profile_id;
@ -3530,7 +3528,6 @@ class ApiV1Controller extends Controller
if (! $in_reply_to_id) { if (! $in_reply_to_id) {
$status = new Status; $status = new Status;
$status->caption = $content; $status->caption = $content;
$status->rendered = $rendered;
$status->profile_id = $user->profile_id; $status->profile_id = $user->profile_id;
$status->is_nsfw = $cw; $status->is_nsfw = $cw;
$status->cw_summary = $spoilerText; $status->cw_summary = $spoilerText;

View file

@ -37,7 +37,6 @@ use App\Status;
use App\StatusArchived; use App\StatusArchived;
use App\User; use App\User;
use App\UserSetting; use App\UserSetting;
use App\Util\Lexer\Autolink;
use App\Util\Lexer\RestrictedNames; use App\Util\Lexer\RestrictedNames;
use Cache; use Cache;
use DB; use DB;
@ -49,6 +48,7 @@ use Jenssegers\Agent\Agent;
use League\Fractal; use League\Fractal;
use League\Fractal\Serializer\ArraySerializer; use League\Fractal\Serializer\ArraySerializer;
use Mail; use Mail;
use Purify;
class ApiV1Dot1Controller extends Controller class ApiV1Dot1Controller extends Controller
{ {
@ -1293,14 +1293,12 @@ class ApiV1Dot1Controller extends Controller
return []; return [];
} }
$content = strip_tags($request->input('status')); $content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : null;
$rendered = Autolink::create()->autolink($content);
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false); $cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null; $spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;
$status = new Status; $status = new Status;
$status->caption = $content; $status->caption = $content;
$status->rendered = $rendered;
$status->profile_id = $user->profile_id; $status->profile_id = $user->profile_id;
$status->is_nsfw = $cw; $status->is_nsfw = $cw;
$status->cw_summary = $spoilerText; $status->cw_summary = $spoilerText;

View file

@ -8,12 +8,12 @@ use App\Services\StatusService;
use App\Status; use App\Status;
use App\Transformer\Api\StatusTransformer; use App\Transformer\Api\StatusTransformer;
use App\UserFilter; use App\UserFilter;
use App\Util\Lexer\Autolink;
use Auth; use Auth;
use DB; use DB;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use League\Fractal; use League\Fractal;
use League\Fractal\Serializer\ArraySerializer; use League\Fractal\Serializer\ArraySerializer;
use Purify;
class CommentController extends Controller class CommentController extends Controller
{ {
@ -56,12 +56,10 @@ class CommentController extends Controller
$reply = DB::transaction(function () use ($comment, $status, $profile, $nsfw) { $reply = DB::transaction(function () use ($comment, $status, $profile, $nsfw) {
$scope = $profile->is_private == true ? 'private' : 'public'; $scope = $profile->is_private == true ? 'private' : 'public';
$autolink = Autolink::create()->autolink($comment); $reply = new Status;
$reply = new Status();
$reply->profile_id = $profile->id; $reply->profile_id = $profile->id;
$reply->is_nsfw = $nsfw; $reply->is_nsfw = $nsfw;
$reply->caption = e($comment); $reply->caption = Purify::clean($comment);
$reply->rendered = $autolink;
$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->scope = $scope; $reply->scope = $scope;
@ -76,9 +74,9 @@ class CommentController extends Controller
CommentPipeline::dispatch($status, $reply); CommentPipeline::dispatch($status, $reply);
if ($request->ajax()) { if ($request->ajax()) {
$fractal = new Fractal\Manager(); $fractal = new Fractal\Manager;
$fractal->setSerializer(new ArraySerializer()); $fractal->setSerializer(new ArraySerializer);
$entity = new Fractal\Resource\Item($reply, new StatusTransformer()); $entity = new Fractal\Resource\Item($reply, new StatusTransformer);
$entity = $fractal->createData($entity)->toArray(); $entity = $fractal->createData($entity)->toArray();
$response = [ $response = [
'code' => 200, 'code' => 200,

View file

@ -25,7 +25,6 @@ use App\Services\UserStorageService;
use App\Status; use App\Status;
use App\Transformer\Api\MediaTransformer; use App\Transformer\Api\MediaTransformer;
use App\UserFilter; use App\UserFilter;
use App\Util\Lexer\Autolink;
use App\Util\Media\Filter; use App\Util\Media\Filter;
use App\Util\Media\License; use App\Util\Media\License;
use Auth; use Auth;
@ -43,8 +42,8 @@ class ComposeController extends Controller
public function __construct() public function __construct()
{ {
$this->middleware('auth'); $this->middleware('auth');
$this->fractal = new Fractal\Manager(); $this->fractal = new Fractal\Manager;
$this->fractal->setSerializer(new ArraySerializer()); $this->fractal->setSerializer(new ArraySerializer);
} }
public function show(Request $request) public function show(Request $request)
@ -112,14 +111,14 @@ class ComposeController extends Controller
abort_if(MediaBlocklistService::exists($hash) == true, 451); abort_if(MediaBlocklistService::exists($hash) == true, 451);
$media = new Media(); $media = new Media;
$media->status_id = null; $media->status_id = null;
$media->profile_id = $profile->id; $media->profile_id = $profile->id;
$media->user_id = $user->id; $media->user_id = $user->id;
$media->media_path = $path; $media->media_path = $path;
$media->original_sha256 = $hash; $media->original_sha256 = $hash;
$media->size = $photo->getSize(); $media->size = $photo->getSize();
$media->caption = ""; $media->caption = '';
$media->mime = $mime; $media->mime = $mime;
$media->filter_class = $filterClass; $media->filter_class = $filterClass;
$media->filter_name = $filterName; $media->filter_name = $filterName;
@ -151,7 +150,7 @@ class ComposeController extends Controller
$user->save(); $user->save();
Cache::forget($limitKey); Cache::forget($limitKey);
$resource = new Fractal\Resource\Item($media, new MediaTransformer()); $resource = new Fractal\Resource\Item($media, new MediaTransformer);
$res = $this->fractal->createData($resource)->toArray(); $res = $this->fractal->createData($resource)->toArray();
$res['preview_url'] = $preview_url; $res['preview_url'] = $preview_url;
$res['url'] = $url; $res['url'] = $url;
@ -571,7 +570,6 @@ class ComposeController extends Controller
} }
$status->caption = strip_tags($request->caption); $status->caption = strip_tags($request->caption);
$status->rendered = Autolink::create()->autolink($status->caption);
$status->scope = 'draft'; $status->scope = 'draft';
$status->visibility = 'draft'; $status->visibility = 'draft';
$status->profile_id = $profile->id; $status->profile_id = $profile->id;
@ -693,7 +691,6 @@ class ComposeController extends Controller
$status->visibility = $visibility; $status->visibility = $visibility;
$status->scope = $visibility; $status->scope = $visibility;
$status->type = 'text'; $status->type = 'text';
$status->rendered = Autolink::create()->autolink($status->caption);
$status->entities = json_encode(array_merge([ $status->entities = json_encode(array_merge([
'timg' => [ 'timg' => [
'version' => 0, 'version' => 0,
@ -806,7 +803,6 @@ class ComposeController extends Controller
$status = new Status; $status = new Status;
$status->profile_id = $request->user()->profile_id; $status->profile_id = $request->user()->profile_id;
$status->caption = $request->input('caption'); $status->caption = $request->input('caption');
$status->rendered = Autolink::create()->autolink($status->caption);
$status->visibility = 'draft'; $status->visibility = 'draft';
$status->scope = 'draft'; $status->scope = 'draft';
$status->type = 'poll'; $status->type = 'poll';

View file

@ -22,6 +22,7 @@ use App\Services\WebfingerService;
use App\Status; use App\Status;
use App\UserFilter; use App\UserFilter;
use App\Util\ActivityPub\Helpers; use App\Util\ActivityPub\Helpers;
use App\Util\Lexer\Autolink;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -326,7 +327,6 @@ class DirectMessageController extends Controller
$status = new Status; $status = new Status;
$status->profile_id = $profile->id; $status->profile_id = $profile->id;
$status->caption = $msg; $status->caption = $msg;
$status->rendered = $msg;
$status->visibility = 'direct'; $status->visibility = 'direct';
$status->scope = 'direct'; $status->scope = 'direct';
$status->in_reply_to_profile_id = $recipient->id; $status->in_reply_to_profile_id = $recipient->id;
@ -636,7 +636,6 @@ class DirectMessageController extends Controller
$status = new Status; $status = new Status;
$status->profile_id = $profile->id; $status->profile_id = $profile->id;
$status->caption = null; $status->caption = null;
$status->rendered = null;
$status->visibility = 'direct'; $status->visibility = 'direct';
$status->scope = 'direct'; $status->scope = 'direct';
$status->in_reply_to_profile_id = $recipient->id; $status->in_reply_to_profile_id = $recipient->id;
@ -830,6 +829,11 @@ class DirectMessageController extends Controller
{ {
$profile = $dm->author; $profile = $dm->author;
$url = $dm->recipient->sharedInbox ?? $dm->recipient->inbox_url; $url = $dm->recipient->sharedInbox ?? $dm->recipient->inbox_url;
$status = $dm->status;
if (! $status) {
return;
}
$tags = [ $tags = [
[ [
@ -839,6 +843,8 @@ class DirectMessageController extends Controller
], ],
]; ];
$content = $status->caption ? Autolink::create()->autolink($status->caption) : null;
$body = [ $body = [
'@context' => [ '@context' => [
'https://w3id.org/security/v1', 'https://w3id.org/security/v1',
@ -854,7 +860,7 @@ class DirectMessageController extends Controller
'id' => $dm->status->url(), 'id' => $dm->status->url(),
'type' => 'Note', 'type' => 'Note',
'summary' => null, 'summary' => null,
'content' => $dm->status->rendered ?? $dm->status->caption, 'content' => $content,
'inReplyTo' => null, 'inReplyTo' => null,
'published' => $dm->status->created_at->toAtomString(), 'published' => $dm->status->created_at->toAtomString(),
'url' => $dm->status->url(), 'url' => $dm->status->url(),

View file

@ -2,13 +2,14 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use App\Models\Group; use App\Models\Group;
use App\Models\GroupPost; use App\Models\GroupPost;
use App\Status;
use App\Models\InstanceActor; use App\Models\InstanceActor;
use App\Services\MediaService; use App\Services\MediaService;
use App\Status;
use App\Util\Lexer\Autolink;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
class GroupFederationController extends Controller class GroupFederationController extends Controller
{ {
@ -16,6 +17,7 @@ class GroupFederationController extends Controller
{ {
$group = Group::whereLocal(true)->whereActivitypub(true)->findOrFail($id); $group = Group::whereLocal(true)->whereActivitypub(true)->findOrFail($id);
$res = $this->showGroupObject($group); $res = $this->showGroupObject($group);
return response()->json($res, 200, [], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); return response()->json($res, 200, [], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
} }
@ -32,7 +34,7 @@ class GroupFederationController extends Controller
'type' => 'Group', 'type' => 'Group',
'attributedTo' => [ 'attributedTo' => [
'type' => 'Person', 'type' => 'Person',
'id' => $group->admin->permalink() 'id' => $group->admin->permalink(),
], ],
// 'endpoints' => [ // 'endpoints' => [
// 'sharedInbox' => config('app.url') . '/f/inbox' // 'sharedInbox' => config('app.url') . '/f/inbox'
@ -43,23 +45,24 @@ class GroupFederationController extends Controller
'owner' => $group->permalink(), 'owner' => $group->permalink(),
'publicKeyPem' => InstanceActor::first()->public_key, 'publicKeyPem' => InstanceActor::first()->public_key,
], ],
'url' => $group->permalink() 'url' => $group->permalink(),
]; ];
if ($group->metadata && isset($group->metadata['avatar'])) { if ($group->metadata && isset($group->metadata['avatar'])) {
$res['icon'] = [ $res['icon'] = [
'type' => 'Image', 'type' => 'Image',
'url' => $group->metadata['avatar']['url'] 'url' => $group->metadata['avatar']['url'],
]; ];
} }
if ($group->metadata && isset($group->metadata['header'])) { if ($group->metadata && isset($group->metadata['header'])) {
$res['image'] = [ $res['image'] = [
'type' => 'Image', 'type' => 'Image',
'url' => $group->metadata['header']['url'] 'url' => $group->metadata['header']['url'],
]; ];
} }
ksort($res); ksort($res);
return $res; return $res;
}); });
} }
@ -70,7 +73,7 @@ class GroupFederationController extends Controller
$gp = GroupPost::whereGroupId($gid)->findOrFail($sid); $gp = GroupPost::whereGroupId($gid)->findOrFail($sid);
$status = Status::findOrFail($gp->status_id); $status = Status::findOrFail($gp->status_id);
// permission check // permission check
$content = $status->caption ? Autolink::create()->autolink($status->caption) : null;
$res = [ $res = [
'@context' => 'https://www.w3.org/ns/activitystreams', '@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $gp->url(), 'id' => $gp->url(),
@ -78,7 +81,7 @@ class GroupFederationController extends Controller
'type' => 'Note', 'type' => 'Note',
'summary' => null, 'summary' => null,
'content' => $status->rendered ?? $status->caption, 'content' => $content,
'inReplyTo' => null, 'inReplyTo' => null,
'published' => $status->created_at->toAtomString(), 'published' => $status->created_at->toAtomString(),
@ -94,9 +97,10 @@ class GroupFederationController extends Controller
'target' => [ 'target' => [
'type' => 'Collection', 'type' => 'Collection',
'id' => $group->permalink('/wall'), 'id' => $group->permalink('/wall'),
'attributedTo' => $group->permalink() 'attributedTo' => $group->permalink(),
] ],
]; ];
// ksort($res); // ksort($res);
return response()->json($res, 200, [], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); return response()->json($res, 200, [], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
} }

View file

@ -2,48 +2,29 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use App\AccountInterstitial;
use App\{ use App\Bookmark;
AccountInterstitial, use App\DirectMessage;
Bookmark, use App\DiscoverCategory;
DirectMessage, use App\Follower;
DiscoverCategory,
Hashtag,
Follower,
Like,
Media,
MediaTag,
Notification,
Profile,
StatusHashtag,
Status,
User,
UserFilter,
};
use Auth,Cache;
use Illuminate\Support\Facades\Redis;
use Carbon\Carbon;
use League\Fractal;
use App\Transformer\Api\{
AccountTransformer,
StatusTransformer,
// StatusMediaContainerTransformer,
};
use App\Util\Media\Filter;
use App\Jobs\StatusPipeline\NewStatusPipeline;
use App\Jobs\ModPipeline\HandleSpammerPipeline; use App\Jobs\ModPipeline\HandleSpammerPipeline;
use League\Fractal\Serializer\ArraySerializer; use App\Profile;
use League\Fractal\Pagination\IlluminatePaginatorAdapter; use App\Services\BookmarkService;
use Illuminate\Validation\Rule; use App\Services\DiscoverService;
use Illuminate\Support\Str;
use App\Services\MediaTagService;
use App\Services\ModLogService; use App\Services\ModLogService;
use App\Services\PublicTimelineService; use App\Services\PublicTimelineService;
use App\Services\SnowflakeService;
use App\Services\StatusService; use App\Services\StatusService;
use App\Services\UserFilterService; use App\Services\UserFilterService;
use App\Services\DiscoverService; use App\Status; // StatusMediaContainerTransformer,
use App\Services\BookmarkService; use App\Transformer\Api\StatusTransformer;
use App\User;
use Auth;
use Cache;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
use Illuminate\Validation\Rule;
use League\Fractal;
use League\Fractal\Serializer\ArraySerializer;
class InternalApiController extends Controller class InternalApiController extends Controller
{ {
@ -52,8 +33,8 @@ class InternalApiController extends Controller
public function __construct() public function __construct()
{ {
$this->middleware('auth'); $this->middleware('auth');
$this->fractal = new Fractal\Manager(); $this->fractal = new Fractal\Manager;
$this->fractal->setSerializer(new ArraySerializer()); $this->fractal->setSerializer(new ArraySerializer);
} }
// deprecated v2 compose api // deprecated v2 compose api
@ -63,10 +44,7 @@ class InternalApiController extends Controller
} }
// deprecated // deprecated
public function discover(Request $request) public function discover(Request $request) {}
{
return;
}
public function discoverPosts(Request $request) public function discoverPosts(Request $request)
{ {
@ -84,6 +62,7 @@ class InternalApiController extends Controller
}) })
->take(12) ->take(12)
->values(); ->values();
return response()->json(compact('posts')); return response()->json(compact('posts'));
} }
@ -110,7 +89,7 @@ class InternalApiController extends Controller
public function statusReplies(Request $request, int $id) public function statusReplies(Request $request, int $id)
{ {
$this->validate($request, [ $this->validate($request, [
'limit' => 'nullable|int|min:1|max:6' 'limit' => 'nullable|int|min:1|max:6',
]); ]);
$parent = Status::whereScope('public')->findOrFail($id); $parent = Status::whereScope('public')->findOrFail($id);
$limit = $request->input('limit') ?? 3; $limit = $request->input('limit') ?? 3;
@ -118,16 +97,13 @@ class InternalApiController extends Controller
->orderBy('created_at', 'desc') ->orderBy('created_at', 'desc')
->take($limit) ->take($limit)
->get(); ->get();
$resource = new Fractal\Resource\Collection($children, new StatusTransformer()); $resource = new Fractal\Resource\Collection($children, new StatusTransformer);
$res = $this->fractal->createData($resource)->toArray(); $res = $this->fractal->createData($resource)->toArray();
return response()->json($res); return response()->json($res);
} }
public function stories(Request $request) public function stories(Request $request) {}
{
}
public function discoverCategories(Request $request) public function discoverCategories(Request $request)
{ {
@ -136,9 +112,10 @@ class InternalApiController extends Controller
return [ return [
'name' => $item->name, 'name' => $item->name,
'url' => $item->url(), 'url' => $item->url(),
'thumb' => $item->thumb() 'thumb' => $item->thumb(),
]; ];
}); });
return response()->json($res); return response()->json($res);
} }
@ -153,15 +130,15 @@ class InternalApiController extends Controller
'addcw', 'addcw',
'remcw', 'remcw',
'unlist', 'unlist',
'spammer' 'spammer',
]) ]),
], ],
'item_id' => 'required|integer|min:1', 'item_id' => 'required|integer|min:1',
'item_type' => [ 'item_type' => [
'required', 'required',
'string', 'string',
Rule::in(['profile', 'status']) Rule::in(['profile', 'status']),
] ],
]); ]);
$action = $request->input('action'); $action = $request->input('action');
@ -184,7 +161,7 @@ class InternalApiController extends Controller
->action('admin.status.moderate') ->action('admin.status.moderate')
->metadata([ ->metadata([
'action' => 'cw', 'action' => 'cw',
'message' => 'Success!' 'message' => 'Success!',
]) ])
->accessLevel('admin') ->accessLevel('admin')
->save(); ->save();
@ -229,7 +206,7 @@ class InternalApiController extends Controller
->action('admin.status.moderate') ->action('admin.status.moderate')
->metadata([ ->metadata([
'action' => 'remove_cw', 'action' => 'remove_cw',
'message' => 'Success!' 'message' => 'Success!',
]) ])
->accessLevel('admin') ->accessLevel('admin')
->save(); ->save();
@ -255,7 +232,7 @@ class InternalApiController extends Controller
->action('admin.status.moderate') ->action('admin.status.moderate')
->metadata([ ->metadata([
'action' => 'unlist', 'action' => 'unlist',
'message' => 'Success!' 'message' => 'Success!',
]) ])
->accessLevel('admin') ->accessLevel('admin')
->save(); ->save();
@ -299,7 +276,7 @@ class InternalApiController extends Controller
->action('admin.status.moderate') ->action('admin.status.moderate')
->metadata([ ->metadata([
'action' => 'spammer', 'action' => 'spammer',
'message' => 'Success!' 'message' => 'Success!',
]) ])
->accessLevel('admin') ->accessLevel('admin')
->save(); ->save();
@ -307,6 +284,7 @@ class InternalApiController extends Controller
} }
StatusService::del($status->id, true); StatusService::del($status->id, true);
return ['msg' => 200]; return ['msg' => 200];
} }
@ -331,6 +309,7 @@ class InternalApiController extends Controller
if ($status) { if ($status) {
BookmarkService::add($pid, $status['id']); BookmarkService::add($pid, $status['id']);
} }
return $status; return $status;
}) })
->filter(function ($bookmark) { ->filter(function ($bookmark) {
@ -350,7 +329,7 @@ class InternalApiController extends Controller
'max_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX, 'max_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX,
'since_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX, 'since_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX,
'min_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX, 'min_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX,
'limit' => 'nullable|integer|min:1|max:24' 'limit' => 'nullable|integer|min:1|max:24',
]); ]);
$profile = Profile::whereNull('status')->findOrFail($id); $profile = Profile::whereNull('status')->findOrFail($id);
@ -369,17 +348,19 @@ class InternalApiController extends Controller
$pid = Auth::user()->profile->id; $pid = Auth::user()->profile->id;
$following = Cache::remember('profile:following:'.$pid, now()->addMinutes(1440), function () use ($pid) { $following = Cache::remember('profile:following:'.$pid, now()->addMinutes(1440), function () use ($pid) {
$following = Follower::whereProfileId($pid)->pluck('following_id'); $following = Follower::whereProfileId($pid)->pluck('following_id');
return $following->push($pid)->toArray(); return $following->push($pid)->toArray();
}); });
$visibility = true == in_array($profile->id, $following) ? ['public', 'unlisted', 'private'] : []; $visibility = in_array($profile->id, $following) == true ? ['public', 'unlisted', 'private'] : [];
} else { } else {
if (Auth::check()) { if (Auth::check()) {
$pid = Auth::user()->profile->id; $pid = Auth::user()->profile->id;
$following = Cache::remember('profile:following:'.$pid, now()->addMinutes(1440), function () use ($pid) { $following = Cache::remember('profile:following:'.$pid, now()->addMinutes(1440), function () use ($pid) {
$following = Follower::whereProfileId($pid)->pluck('following_id'); $following = Follower::whereProfileId($pid)->pluck('following_id');
return $following->push($pid)->toArray(); return $following->push($pid)->toArray();
}); });
$visibility = true == in_array($profile->id, $following) ? ['public', 'unlisted', 'private'] : ['public', 'unlisted']; $visibility = in_array($profile->id, $following) == true ? ['public', 'unlisted', 'private'] : ['public', 'unlisted'];
} else { } else {
$visibility = ['public', 'unlisted']; $visibility = ['public', 'unlisted'];
} }
@ -391,7 +372,6 @@ class InternalApiController extends Controller
'id', 'id',
'uri', 'uri',
'caption', 'caption',
'rendered',
'profile_id', 'profile_id',
'type', 'type',
'in_reply_to_id', 'in_reply_to_id',
@ -411,7 +391,7 @@ class InternalApiController extends Controller
->limit($limit) ->limit($limit)
->get(); ->get();
$resource = new Fractal\Resource\Collection($timeline, new StatusTransformer()); $resource = new Fractal\Resource\Collection($timeline, new StatusTransformer);
$res = $this->fractal->createData($resource)->toArray(); $res = $this->fractal->createData($resource)->toArray();
return response()->json($res); return response()->json($res);
@ -431,6 +411,7 @@ class InternalApiController extends Controller
{ {
$pid = $request->user()->profile_id; $pid = $request->user()->profile_id;
$exists = Redis::sismember('email:manual', $pid); $exists = Redis::sismember('email:manual', $pid);
return view('account.email.request_verification', compact('exists')); return view('account.email.request_verification', compact('exists'));
} }
@ -438,6 +419,7 @@ class InternalApiController extends Controller
{ {
$pid = $request->user()->profile_id; $pid = $request->user()->profile_id;
Redis::sadd('email:manual', $pid); Redis::sadd('email:manual', $pid);
return redirect('/i/verify-email')->with(['status' => 'Successfully sent manual verification request!']); return redirect('/i/verify-email')->with(['status' => 'Successfully sent manual verification request!']);
} }
} }

View file

@ -2,12 +2,10 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Status;
use Auth;
use DB;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\{
Profile,
Status,
};
use Auth, DB, Purify;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
class MicroController extends Controller class MicroController extends Controller
@ -23,7 +21,7 @@ class MicroController extends Controller
'type' => [ 'type' => [
'required', 'required',
'string', 'string',
Rule::in(['text']) Rule::in(['text']),
], ],
'title' => 'nullable|string|max:140', 'title' => 'nullable|string|max:140',
'content' => 'required|string|max:500', 'content' => 'required|string|max:500',
@ -34,9 +32,9 @@ class MicroController extends Controller
'public', 'public',
'unlisted', 'unlisted',
'private', 'private',
'draft' 'draft',
]) ]),
] ],
]); ]);
$profile = Auth::user()->profile; $profile = Auth::user()->profile;
$title = $request->input('title'); $title = $request->input('title');
@ -48,7 +46,6 @@ class MicroController extends Controller
$status->type = 'text'; $status->type = 'text';
$status->profile_id = $profile->id; $status->profile_id = $profile->id;
$status->caption = strip_tags($content); $status->caption = strip_tags($content);
$status->rendered = Purify::clean($content);
$status->is_nsfw = false; $status->is_nsfw = false;
// TODO: remove deprecated visibility in favor of scope // TODO: remove deprecated visibility in favor of scope
@ -56,12 +53,14 @@ class MicroController extends Controller
$status->scope = $visibility; $status->scope = $visibility;
$status->entities = json_encode(['title' => $title]); $status->entities = json_encode(['title' => $title]);
$status->save(); $status->save();
return $status; return $status;
}); });
$fractal = new \League\Fractal\Manager(); $fractal = new \League\Fractal\Manager;
$fractal->setSerializer(new \League\Fractal\Serializer\ArraySerializer()); $fractal->setSerializer(new \League\Fractal\Serializer\ArraySerializer);
$s = new \League\Fractal\Resource\Item($status, new \App\Transformer\Api\StatusTransformer()); $s = new \League\Fractal\Resource\Item($status, new \App\Transformer\Api\StatusTransformer);
return $fractal->createData($s)->toArray(); return $fractal->createData($s)->toArray();
} }
} }

View file

@ -8,6 +8,7 @@ use App\Profile;
use App\Services\WebfingerService; use App\Services\WebfingerService;
use App\Status; use App\Status;
use App\Util\ActivityPub\Helpers; use App\Util\ActivityPub\Helpers;
use App\Util\Lexer\Autolink;
use Auth; use Auth;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
@ -320,17 +321,21 @@ class SearchController extends Controller
if (Status::whereUri($tag)->whereLocal(false)->exists()) { if (Status::whereUri($tag)->whereLocal(false)->exists()) {
$item = Status::whereUri($tag)->first(); $item = Status::whereUri($tag)->first();
if (! $item) {
return;
}
$media = $item->firstMedia(); $media = $item->firstMedia();
$url = null; $url = null;
if ($media) { if ($media) {
$url = $media->remote_url; $url = $media->remote_url;
} }
$content = $item->caption ? Autolink::create()->autolink($item->caption) : null;
$this->tokens['posts'] = [[ $this->tokens['posts'] = [[
'count' => 0, 'count' => 0,
'url' => "/i/web/post/_/$item->profile_id/$item->id", 'url' => "/i/web/post/_/$item->profile_id/$item->id",
'type' => 'status', 'type' => 'status',
'username' => $item->profile->username, 'username' => $item->profile->username,
'caption' => $item->rendered ?? $item->caption, 'caption' => $content,
'thumb' => $url, 'thumb' => $url,
'timestamp' => $item->created_at->diffForHumans(), 'timestamp' => $item->created_at->diffForHumans(),
]]; ]];
@ -340,17 +345,21 @@ class SearchController extends Controller
if (isset($remote['type']) && $remote['type'] == 'Note') { if (isset($remote['type']) && $remote['type'] == 'Note') {
$item = Helpers::statusFetch($tag); $item = Helpers::statusFetch($tag);
if (! $item) {
return;
}
$media = $item->firstMedia(); $media = $item->firstMedia();
$url = null; $url = null;
if ($media) { if ($media) {
$url = $media->remote_url; $url = $media->remote_url;
} }
$content = $item->caption ? Autolink::create()->autolink($item->caption) : null;
$this->tokens['posts'] = [[ $this->tokens['posts'] = [[
'count' => 0, 'count' => 0,
'url' => "/i/web/post/_/$item->profile_id/$item->id", 'url' => "/i/web/post/_/$item->profile_id/$item->id",
'type' => 'status', 'type' => 'status',
'username' => $item->profile->username, 'username' => $item->profile->username,
'caption' => $item->rendered ?? $item->caption, 'caption' => $content,
'thumb' => $url, 'thumb' => $url,
'timestamp' => $item->created_at->diffForHumans(), 'timestamp' => $item->created_at->diffForHumans(),
]]; ]];

View file

@ -281,7 +281,7 @@ class StoryApiV1Controller extends Controller
$photo = $request->file('file'); $photo = $request->file('file');
$path = $this->storeMedia($photo, $user); $path = $this->storeMedia($photo, $user);
$story = new Story(); $story = new Story;
$story->duration = $request->input('duration', 3); $story->duration = $request->input('duration', 3);
$story->profile_id = $user->profile_id; $story->profile_id = $user->profile_id;
$story->type = Str::endsWith($photo->getMimeType(), 'mp4') ? 'video' : 'photo'; $story->type = Str::endsWith($photo->getMimeType(), 'mp4') ? 'video' : 'photo';
@ -418,7 +418,6 @@ class StoryApiV1Controller extends Controller
$status->type = 'story:reply'; $status->type = 'story:reply';
$status->profile_id = $pid; $status->profile_id = $pid;
$status->caption = $text; $status->caption = $text;
$status->rendered = $text;
$status->scope = 'direct'; $status->scope = 'direct';
$status->visibility = 'direct'; $status->visibility = 'direct';
$status->in_reply_to_profile_id = $story->profile_id; $status->in_reply_to_profile_id = $story->profile_id;

View file

@ -54,7 +54,7 @@ class StoryComposeController extends Controller
$photo = $request->file('file'); $photo = $request->file('file');
$path = $this->storePhoto($photo, $user); $path = $this->storePhoto($photo, $user);
$story = new Story(); $story = new Story;
$story->duration = 3; $story->duration = 3;
$story->profile_id = $user->profile_id; $story->profile_id = $user->profile_id;
$story->type = Str::endsWith($photo->getMimeType(), 'mp4') ? 'video' : 'photo'; $story->type = Str::endsWith($photo->getMimeType(), 'mp4') ? 'video' : 'photo';
@ -403,7 +403,6 @@ class StoryComposeController extends Controller
$status->profile_id = $pid; $status->profile_id = $pid;
$status->type = 'story:reaction'; $status->type = 'story:reaction';
$status->caption = $text; $status->caption = $text;
$status->rendered = $text;
$status->scope = 'direct'; $status->scope = 'direct';
$status->visibility = 'direct'; $status->visibility = 'direct';
$status->in_reply_to_profile_id = $story->profile_id; $status->in_reply_to_profile_id = $story->profile_id;
@ -477,7 +476,6 @@ class StoryComposeController extends Controller
$status->type = 'story:reply'; $status->type = 'story:reply';
$status->profile_id = $pid; $status->profile_id = $pid;
$status->caption = $text; $status->caption = $text;
$status->rendered = $text;
$status->scope = 'direct'; $status->scope = 'direct';
$status->visibility = 'direct'; $status->visibility = 'direct';
$status->in_reply_to_profile_id = $story->profile_id; $status->in_reply_to_profile_id = $story->profile_id;

View file

@ -2,35 +2,32 @@
namespace App\Jobs\GroupPipeline; namespace App\Jobs\GroupPipeline;
use App\Notification;
use App\Hashtag; use App\Hashtag;
use App\Mention; use App\Mention;
use App\Profile;
use App\Status;
use App\StatusHashtag;
use App\Models\GroupPostHashtag;
use App\Models\GroupPost; use App\Models\GroupPost;
use Cache; use App\Models\GroupPostHashtag;
use App\Profile;
use App\Services\StatusService;
use App\Status;
use App\Util\Lexer\Autolink;
use App\Util\Lexer\Extractor;
use DB; use DB;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Redis;
use App\Services\MediaStorageService;
use App\Services\NotificationService;
use App\Services\StatusService;
use App\Util\Lexer\Autolink;
use App\Util\Lexer\Extractor;
class NewStatusPipeline implements ShouldQueue class NewStatusPipeline implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $status; protected $status;
protected $gp; protected $gp;
protected $tags; protected $tags;
protected $mentions; protected $mentions;
public function __construct(Status $status, GroupPost $gp) public function __construct(Status $status, GroupPost $gp)
@ -50,10 +47,6 @@ class NewStatusPipeline implements ShouldQueue
->autolink($status->caption); ->autolink($status->caption);
$entities = Extractor::create()->extract($status->caption); $entities = Extractor::create()->extract($status->caption);
$autolink = str_replace('/discover/tags/', '/groups/' . $status->group_id . '/topics/', $autolink);
$status->rendered = nl2br($autolink);
$status->entities = null; $status->entities = null;
$status->save(); $status->save();
@ -117,7 +110,7 @@ class NewStatusPipeline implements ShouldQueue
} }
DB::transaction(function () use ($status, $mentioned) { DB::transaction(function () use ($status, $mentioned) {
$m = new Mention(); $m = new Mention;
$m->status_id = $status->id; $m->status_id = $status->id;
$m->profile_id = $mentioned->id; $m->profile_id = $mentioned->id;
$m->save(); $m->save();

View file

@ -91,11 +91,6 @@ class StatusEntityLexer implements ShouldQueue
public function storeEntities() public function storeEntities()
{ {
$this->storeHashtags(); $this->storeHashtags();
DB::transaction(function () {
$status = $this->status;
$status->rendered = nl2br($this->autolink);
$status->save();
});
} }
public function storeHashtags() public function storeHashtags()
@ -146,7 +141,7 @@ class StatusEntityLexer implements ShouldQueue
} }
DB::transaction(function () use ($status, $mentioned) { DB::transaction(function () use ($status, $mentioned) {
$m = new Mention(); $m = new Mention;
$m->status_id = $status->id; $m->status_id = $status->id;
$m->profile_id = $mentioned->id; $m->profile_id = $mentioned->id;
$m->save(); $m->save();

View file

@ -120,8 +120,7 @@ class StatusRemoteUpdatePipeline implements ShouldQueue
protected function updateImmediateAttributes($status, $activity) protected function updateImmediateAttributes($status, $activity)
{ {
if (isset($activity['content'])) { if (isset($activity['content'])) {
$status->caption = strip_tags($activity['content']); $status->caption = strip_tags(Purify::clean($activity['content']));
$status->rendered = Purify::clean($activity['content']);
} }
if (isset($activity['sensitive'])) { if (isset($activity['sensitive'])) {

View file

@ -2,53 +2,25 @@
namespace App\Services; namespace App\Services;
use Cache;
use App\Profile; use App\Profile;
use Illuminate\Support\Str; use Cache;
use Illuminate\Support\Facades\Http; use Purify;
use App\Util\Webfinger\WebfingerUrl;
class AutolinkService class AutolinkService
{ {
const CACHE_KEY = 'pf:services:autolink:'; const CACHE_KEY = 'pf:services:autolink:mue:';
public static function mentionedUsernameExists($username) public static function mentionedUsernameExists($username)
{ {
$key = 'pf:services:autolink:userexists:' . hash('sha256', $username); if (str_starts_with($username, '@')) {
if (substr_count($username, '@') === 1) {
$username = substr($username, 1);
}
}
$name = Purify::clean(strtolower($username));
return Cache::remember($key, 3600, function() use($username) { return Cache::remember(self::CACHE_KEY.base64_encode($name), 7200, function () use ($name) {
$remote = Str::of($username)->contains('@'); return Profile::where('username', $name)->exists();
$profile = Profile::whereUsername($username)->first();
if($profile) {
if($profile->domain != null) {
$instance = InstanceService::getByDomain($profile->domain);
if($instance && $instance->banned == true) {
return false;
}
}
return true;
} else {
if($remote) {
$parts = explode('@', $username);
$domain = last($parts);
$instance = InstanceService::getByDomain($domain);
if($instance) {
if($instance->banned == true) {
return false;
} else {
$wf = WebfingerUrl::generateWebfingerUrl($username);
$res = Http::head($wf);
return $res->ok();
}
} else {
$wf = WebfingerUrl::generateWebfingerUrl($username);
$res = Http::head($wf);
return $res->ok();
}
}
}
return false;
}); });
} }
} }

View file

@ -3,14 +3,13 @@
namespace App\Services\Status; namespace App\Services\Status;
use App\Media; use App\Media;
use App\ModLog;
use App\Status;
use App\Models\StatusEdit; use App\Models\StatusEdit;
use Purify; use App\ModLog;
use App\Util\Lexer\Autolink;
use App\Services\MediaService; use App\Services\MediaService;
use App\Services\MediaStorageService; use App\Services\MediaStorageService;
use App\Services\StatusService; use App\Services\StatusService;
use App\Status;
use Purify;
class UpdateStatusService class UpdateStatusService
{ {
@ -31,7 +30,9 @@ class UpdateStatusService
return; return;
} }
$oids = $status->media()->orderBy('order')->pluck('id')->map(function($m) { return (string) $m; }); $oids = $status->media()->orderBy('order')->pluck('id')->map(function ($m) {
return (string) $m;
});
$nids = collect($attributes['media_ids']); $nids = collect($attributes['media_ids']);
if ($oids->toArray() === $nids->toArray()) { if ($oids->toArray() === $nids->toArray()) {
@ -64,15 +65,12 @@ class UpdateStatusService
if (isset($attributes['status'])) { if (isset($attributes['status'])) {
$cleaned = Purify::clean($attributes['status']); $cleaned = Purify::clean($attributes['status']);
$status->caption = $cleaned; $status->caption = $cleaned;
$status->rendered = nl2br(Autolink::create()->autolink($cleaned));
} else { } else {
$status->caption = null; $status->caption = null;
$status->rendered = null;
} }
if (isset($attributes['sensitive'])) { if (isset($attributes['sensitive'])) {
if ($status->is_nsfw != (bool) $attributes['sensitive'] && if ($status->is_nsfw != (bool) $attributes['sensitive'] &&
(bool) $attributes['sensitive'] == false) (bool) $attributes['sensitive'] == false) {
{
$exists = ModLog::whereObjectType('App\Status::class') $exists = ModLog::whereObjectType('App\Status::class')
->whereObjectId($status->id) ->whereObjectId($status->id)
->whereAction('admin.status.moderate') ->whereAction('admin.status.moderate')
@ -114,7 +112,7 @@ class UpdateStatusService
'spoiler_text' => $status->cw_summary, 'spoiler_text' => $status->cw_summary,
'is_nsfw' => $status->is_nsfw, 'is_nsfw' => $status->is_nsfw,
'ordered_media_attachment_ids' => $status->media()->orderBy('order')->pluck('id')->toArray(), 'ordered_media_attachment_ids' => $status->media()->orderBy('order')->pluck('id')->toArray(),
'created_at' => $status->created_at 'created_at' => $status->created_at,
]); ]);
} }
} }
@ -131,7 +129,7 @@ class UpdateStatusService
'caption' => $cleaned, 'caption' => $cleaned,
'spoiler_text' => $spoiler_text, 'spoiler_text' => $spoiler_text,
'is_nsfw' => $sensitive, 'is_nsfw' => $sensitive,
'ordered_media_attachment_ids' => $mids 'ordered_media_attachment_ids' => $mids,
]); ]);
} }
} }

View file

@ -694,8 +694,7 @@ class Helpers
$status->url = isset($res['url']) ? $res['url'] : $url; $status->url = isset($res['url']) ? $res['url'] : $url;
$status->uri = isset($res['url']) ? $res['url'] : $url; $status->uri = isset($res['url']) ? $res['url'] : $url;
$status->object_url = $id; $status->object_url = $id;
$status->caption = strip_tags($res['content']); $status->caption = strip_tags(Purify::clean($res['content']));
$status->rendered = Purify::clean($res['content']);
$status->created_at = Carbon::parse($ts)->tz('UTC'); $status->created_at = Carbon::parse($ts)->tz('UTC');
$status->in_reply_to_id = null; $status->in_reply_to_id = null;
$status->local = false; $status->local = false;

View file

@ -438,7 +438,6 @@ class Inbox
$status = new Status; $status = new Status;
$status->profile_id = $actor->id; $status->profile_id = $actor->id;
$status->caption = $msgText; $status->caption = $msgText;
$status->rendered = $msg;
$status->visibility = 'direct'; $status->visibility = 'direct';
$status->scope = 'direct'; $status->scope = 'direct';
$status->url = $activity['id']; $status->url = $activity['id'];
@ -1081,7 +1080,6 @@ class Inbox
$status->uri = $url; $status->uri = $url;
$status->object_url = $url; $status->object_url = $url;
$status->caption = $text; $status->caption = $text;
$status->rendered = $text;
$status->scope = 'direct'; $status->scope = 'direct';
$status->visibility = 'direct'; $status->visibility = 'direct';
$status->in_reply_to_profile_id = $story->profile_id; $status->in_reply_to_profile_id = $story->profile_id;
@ -1199,7 +1197,6 @@ class Inbox
$status->profile_id = $actorProfile->id; $status->profile_id = $actorProfile->id;
$status->type = 'story:reply'; $status->type = 'story:reply';
$status->caption = $text; $status->caption = $text;
$status->rendered = $text;
$status->url = $url; $status->url = $url;
$status->uri = $url; $status->uri = $url;
$status->object_url = $url; $status->object_url = $url;