1
0
Fork 0
forked from mirror/pixelfed

Merge pull request #1683 from pixelfed/staging

Fix AP Inbox
This commit is contained in:
daniel 2019-09-08 21:55:55 -06:00 committed by GitHub
commit f7aeb8f433
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 2 deletions

View file

@ -220,7 +220,7 @@ class Helpers {
$id = (int) last(explode('/', $url)); $id = (int) last(explode('/', $url));
return Status::findOrFail($id); return Status::findOrFail($id);
} else { } else {
$cached = Status::whereUri($url)->orWhere('url', $url)->first(); $cached = Status::whereUri($url)->orWhere('object_url', $url)->first();
if($cached) { if($cached) {
return $cached; return $cached;
} }
@ -317,6 +317,7 @@ class Helpers {
$status->profile_id = $profile->id; $status->profile_id = $profile->id;
$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 = isset($res['id']) ? $res['id'] : $url;
$status->caption = strip_tags($res['content']); $status->caption = strip_tags($res['content']);
$status->rendered = Purify::clean($res['content']); $status->rendered = Purify::clean($res['content']);
$status->created_at = Carbon::parse($ts); $status->created_at = Carbon::parse($ts);

View file

@ -326,7 +326,7 @@ class Inbox
break; break;
case 'Tombstone': case 'Tombstone':
$status = Status::whereUri($id)->first(); $status = Status::whereUri($id)->orWhere('object_url', $id)->first();
if(!$status) { if(!$status) {
return; return;
} }

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddObjectIdToStatusesTable extends Migration
{
public function __construct()
{
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('statuses', function (Blueprint $table) {
$table->string('object_url')->nullable()->unique()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('statuses', function (Blueprint $table) {
$table->dropColumn('object_url');
});
}
}