mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 22:43:18 +00:00
commit
2d4e6ae620
8 changed files with 38 additions and 13 deletions
|
@ -3494,7 +3494,8 @@ class ApiV1Controller extends Controller
|
|||
return [];
|
||||
}
|
||||
|
||||
$content = $request->filled('status') ? strip_tags($request->input('status')) : null;
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
$content = $request->filled('status') ? strip_tags($request->input('status')) : $defaultCaption;
|
||||
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
|
||||
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;
|
||||
|
||||
|
@ -3508,6 +3509,7 @@ class ApiV1Controller extends Controller
|
|||
|
||||
$status = new Status;
|
||||
$status->caption = $content;
|
||||
$status->rendered = $defaultCaption;
|
||||
$status->scope = $visibility;
|
||||
$status->visibility = $visibility;
|
||||
$status->profile_id = $user->profile_id;
|
||||
|
@ -3532,6 +3534,7 @@ class ApiV1Controller extends Controller
|
|||
if (! $in_reply_to_id) {
|
||||
$status = new Status;
|
||||
$status->caption = $content;
|
||||
$status->rendered = $defaultCaption;
|
||||
$status->profile_id = $user->profile_id;
|
||||
$status->is_nsfw = $cw;
|
||||
$status->cw_summary = $spoilerText;
|
||||
|
@ -3684,7 +3687,10 @@ class ApiV1Controller extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
$share = Status::firstOrCreate([
|
||||
'caption' => $defaultCaption,
|
||||
'rendered' => $defaultCaption,
|
||||
'profile_id' => $user->profile_id,
|
||||
'reblog_of_id' => $status->id,
|
||||
'type' => 'share',
|
||||
|
|
|
@ -1292,13 +1292,14 @@ class ApiV1Dot1Controller extends Controller
|
|||
if ($user->last_active_at == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : null;
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
$content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : $defaultCaption;
|
||||
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
|
||||
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;
|
||||
|
||||
$status = new Status;
|
||||
$status->caption = $content;
|
||||
$status->rendered = $defaultCaption;
|
||||
$status->profile_id = $user->profile_id;
|
||||
$status->is_nsfw = $cw;
|
||||
$status->cw_summary = $spoilerText;
|
||||
|
|
|
@ -55,11 +55,14 @@ class CommentController extends Controller
|
|||
}
|
||||
|
||||
$reply = DB::transaction(function () use ($comment, $status, $profile, $nsfw) {
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
|
||||
$scope = $profile->is_private == true ? 'private' : 'public';
|
||||
$reply = new Status;
|
||||
$reply->profile_id = $profile->id;
|
||||
$reply->is_nsfw = $nsfw;
|
||||
$reply->caption = Purify::clean($comment);
|
||||
$reply->rendered = $defaultCaption;
|
||||
$reply->in_reply_to_id = $status->id;
|
||||
$reply->in_reply_to_profile_id = $status->profile_id;
|
||||
$reply->scope = $scope;
|
||||
|
|
|
@ -30,6 +30,7 @@ use App\Util\Media\License;
|
|||
use Auth;
|
||||
use Cache;
|
||||
use DB;
|
||||
use Purify;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
use League\Fractal;
|
||||
|
@ -569,7 +570,9 @@ class ComposeController extends Controller
|
|||
$status->cw_summary = $request->input('spoiler_text');
|
||||
}
|
||||
|
||||
$status->caption = strip_tags($request->caption);
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
$status->caption = strip_tags($request->input('caption')) ?? $defaultCaption;
|
||||
$status->rendered = $defaultCaption;
|
||||
$status->scope = 'draft';
|
||||
$status->visibility = 'draft';
|
||||
$status->profile_id = $profile->id;
|
||||
|
@ -673,6 +676,7 @@ class ComposeController extends Controller
|
|||
$place = $request->input('place');
|
||||
$cw = $request->input('cw');
|
||||
$tagged = $request->input('tagged');
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
|
||||
if ($place && is_array($place)) {
|
||||
$status->place_id = $place['id'];
|
||||
|
@ -682,7 +686,8 @@ class ComposeController extends Controller
|
|||
$status->comments_disabled = (bool) $request->input('comments_disabled');
|
||||
}
|
||||
|
||||
$status->caption = strip_tags($request->caption);
|
||||
$status->caption = $request->filled('caption') ? strip_tags($request->caption) : $defaultCaption;
|
||||
$status->rendered = $defaultCaption;
|
||||
$status->profile_id = $profile->id;
|
||||
$entities = [];
|
||||
$visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility;
|
||||
|
|
|
@ -309,7 +309,7 @@ class StatusController extends Controller
|
|||
abort_if(! $statusAccount || isset($statusAccount['moved'], $statusAccount['moved']['id']), 422, 'Account moved');
|
||||
|
||||
$count = $status->reblogs_count;
|
||||
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
$exists = Status::whereProfileId(Auth::user()->profile->id)
|
||||
->whereReblogOfId($status->id)
|
||||
->exists();
|
||||
|
@ -324,6 +324,8 @@ class StatusController extends Controller
|
|||
}
|
||||
} else {
|
||||
$share = new Status;
|
||||
$share->caption = $defaultCaption;
|
||||
$share->rendered = $defaultCaption;
|
||||
$share->profile_id = $profile->id;
|
||||
$share->reblog_of_id = $status->id;
|
||||
$share->in_reply_to_profile_id = $status->profile_id;
|
||||
|
|
|
@ -543,7 +543,7 @@ class Helpers
|
|||
$scope = 'unlisted';
|
||||
}
|
||||
}
|
||||
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
$status = Status::updateOrCreate(
|
||||
[
|
||||
'uri' => $url,
|
||||
|
@ -551,7 +551,8 @@ class Helpers
|
|||
'profile_id' => $pid,
|
||||
'url' => $url,
|
||||
'object_url' => $id,
|
||||
'caption' => isset($activity['content']) ? Purify::clean(strip_tags($activity['content'])) : null,
|
||||
'caption' => isset($activity['content']) ? Purify::clean(strip_tags($activity['content'])) : $defaultCaption,
|
||||
'rendered' => $defaultCaption,
|
||||
'created_at' => Carbon::parse($ts)->tz('UTC'),
|
||||
'in_reply_to_id' => $reply_to,
|
||||
'local' => false,
|
||||
|
@ -688,12 +689,14 @@ class Helpers
|
|||
return $option['replies']['totalItems'] ?? 0;
|
||||
})->toArray();
|
||||
|
||||
$defaultCaption = config_cache('database.default') === 'mysql' ? null : "";
|
||||
$status = new Status;
|
||||
$status->profile_id = $profile->id;
|
||||
$status->url = isset($res['url']) ? $res['url'] : $url;
|
||||
$status->uri = isset($res['url']) ? $res['url'] : $url;
|
||||
$status->object_url = $id;
|
||||
$status->caption = strip_tags(Purify::clean($res['content']));
|
||||
$status->caption = strip_tags(Purify::clean($res['content'])) ?? $defaultCaption;
|
||||
$status->rendered = $defaultCaption;
|
||||
$status->created_at = Carbon::parse($ts)->tz('UTC');
|
||||
$status->in_reply_to_id = null;
|
||||
$status->local = false;
|
||||
|
|
|
@ -71,9 +71,14 @@ class HttpSignature
|
|||
public static function instanceActorSign($url, $body = false, $addlHeaders = [], $method = 'post')
|
||||
{
|
||||
$keyId = config('app.url').'/i/actor#main-key';
|
||||
$privateKey = Cache::rememberForever(InstanceActor::PKI_PRIVATE, function () {
|
||||
return InstanceActor::first()->private_key;
|
||||
});
|
||||
if(config_cache('database.default') === 'mysql') {
|
||||
$privateKey = Cache::rememberForever(InstanceActor::PKI_PRIVATE, function () {
|
||||
return InstanceActor::first()->private_key;
|
||||
});
|
||||
} else {
|
||||
$privateKey = InstanceActor::first()?->private_key;
|
||||
}
|
||||
abort_if(!$privateKey || empty($privateKey), 400, 'Missing instance actor key, please run php artisan instance:actor');
|
||||
if ($body) {
|
||||
$digest = self::_digest($body);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class CreateDirectMessagesTable extends Migration
|
|||
$table->bigInteger('from_id')->unsigned()->index();
|
||||
$table->string('from_profile_ids')->nullable();
|
||||
$table->boolean('group_message')->default(false);
|
||||
$table->bigInteger('status_id')->unsigned()->integer();
|
||||
$table->bigInteger('status_id')->unsigned();
|
||||
$table->unique(['to_id', 'from_id', 'status_id']);
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
|
Loading…
Reference in a new issue