From f4b9e1fb270eeb3db8882e2c887494c5ba7d45dc Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 1 Oct 2018 12:05:33 +0200 Subject: [PATCH 01/21] Actually use HORIZON_EMBED env in docker script. --- contrib/docker/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/docker/start.sh b/contrib/docker/start.sh index be374a914..59c54b978 100755 --- a/contrib/docker/start.sh +++ b/contrib/docker/start.sh @@ -9,7 +9,7 @@ php artisan storage:link php artisan migrate --force # Run a worker if it is set as embedded -if [ HORIZON_EMBED = true ]; then +if [ $HORIZON_EMBED = true ]; then php artisan horizon & fi From 6288df391dc3f339a4e2d10e16b87dc930f95905 Mon Sep 17 00:00:00 2001 From: Joshua Date: Thu, 4 Oct 2018 11:00:15 -0500 Subject: [PATCH 02/21] Login Test --- tests/Feature/LoginTest.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/Feature/LoginTest.php diff --git a/tests/Feature/LoginTest.php b/tests/Feature/LoginTest.php new file mode 100644 index 000000000..9a70913bf --- /dev/null +++ b/tests/Feature/LoginTest.php @@ -0,0 +1,29 @@ +get('login'); + + $response->assertSuccessful() + ->assertSee('Forgot Your Password?'); + } + + /** @test */ + public function view_register_page() + { + $response = $this->get('register'); + + $response->assertSuccessful() + ->assertSee('Register a new account'); + } +} \ No newline at end of file From f6ed376dc162148cce0e464f1d323aee6a78f56b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 4 Oct 2018 15:20:51 -0600 Subject: [PATCH 03/21] Update LoginTest --- tests/Feature/LoginTest.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/Feature/LoginTest.php b/tests/Feature/LoginTest.php index 9a70913bf..4eb515252 100644 --- a/tests/Feature/LoginTest.php +++ b/tests/Feature/LoginTest.php @@ -21,9 +21,13 @@ class LoginTest extends TestCase /** @test */ public function view_register_page() { - $response = $this->get('register'); + if(true === config('pixelfed.open_registration')) { + $response = $this->get('register'); - $response->assertSuccessful() - ->assertSee('Register a new account'); + $response->assertSuccessful() + ->assertSee('Register a new account'); + } else { + $this->assertTrue(true); + } } } \ No newline at end of file From 45a48270d641a1a58df9c6b538b6948b99b3f1a7 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 4 Oct 2018 15:43:08 -0600 Subject: [PATCH 04/21] Update LoginTest --- tests/Feature/LoginTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Feature/LoginTest.php b/tests/Feature/LoginTest.php index 4eb515252..c2e54df94 100644 --- a/tests/Feature/LoginTest.php +++ b/tests/Feature/LoginTest.php @@ -3,11 +3,9 @@ namespace Tests\Feature; use Tests\TestCase; -use Illuminate\Foundation\Testing\DatabaseTransactions; class LoginTest extends TestCase { - use DatabaseTransactions; /** @test */ public function view_login_page() From 3050d21612064d7b1a62f4f6177866f454455f76 Mon Sep 17 00:00:00 2001 From: Giovanni Smecca Date: Fri, 5 Oct 2018 18:25:45 -0500 Subject: [PATCH 05/21] grammar adjustments --- resources/views/errors/500.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/errors/500.blade.php b/resources/views/errors/500.blade.php index 0e134790a..b163d53c9 100644 --- a/resources/views/errors/500.blade.php +++ b/resources/views/errors/500.blade.php @@ -6,7 +6,7 @@

Whoops! Something went wrong.

-

Please try again, if this error keeps happening please contact an admin.

+

If you keep seeing this message, please contact an admin.

From 4794182334c5d22357b99a7ed41828fd5d02214f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:15:17 -0600 Subject: [PATCH 06/21] Add new migrations --- ...2018_09_19_060554_create_stories_table.php | 34 +++++++++++++++++ ...19_060611_create_story_reactions_table.php | 33 ++++++++++++++++ ..._09_27_040314_create_collections_table.php | 37 ++++++++++++++++++ ...30_051108_create_direct_messages_table.php | 38 +++++++++++++++++++ ...2_040917_create_collection_items_table.php | 35 +++++++++++++++++ ...3717_update_status_visibility_defaults.php | 28 ++++++++++++++ 6 files changed, 205 insertions(+) create mode 100644 database/migrations/2018_09_19_060554_create_stories_table.php create mode 100644 database/migrations/2018_09_19_060611_create_story_reactions_table.php create mode 100644 database/migrations/2018_09_27_040314_create_collections_table.php create mode 100644 database/migrations/2018_09_30_051108_create_direct_messages_table.php create mode 100644 database/migrations/2018_10_02_040917_create_collection_items_table.php create mode 100644 database/migrations/2018_10_09_043717_update_status_visibility_defaults.php diff --git a/database/migrations/2018_09_19_060554_create_stories_table.php b/database/migrations/2018_09_19_060554_create_stories_table.php new file mode 100644 index 000000000..5f204ea11 --- /dev/null +++ b/database/migrations/2018_09_19_060554_create_stories_table.php @@ -0,0 +1,34 @@ +increments('bigIncrements'); + $table->bigInteger('profile_id')->unsigned(); + $table->timestamp('published_at')->nullable(); + $table->timestamp('expires_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('stories'); + } +} diff --git a/database/migrations/2018_09_19_060611_create_story_reactions_table.php b/database/migrations/2018_09_19_060611_create_story_reactions_table.php new file mode 100644 index 000000000..eb1d71782 --- /dev/null +++ b/database/migrations/2018_09_19_060611_create_story_reactions_table.php @@ -0,0 +1,33 @@ +bigIncrements('id'); + $table->bigInteger('profile_id')->unsigned()->nullable(); + $table->string('reaction')->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('story_reactions'); + } +} diff --git a/database/migrations/2018_09_27_040314_create_collections_table.php b/database/migrations/2018_09_27_040314_create_collections_table.php new file mode 100644 index 000000000..580d993c3 --- /dev/null +++ b/database/migrations/2018_09_27_040314_create_collections_table.php @@ -0,0 +1,37 @@ +bigIncrements('id'); + $table->bigInteger('profile_id')->unsigned()->nullable(); + $table->string('title')->nullable(); + $table->text('description')->nullable(); + $table->boolean('is_nsfw')->default(false); + $table->string('visibility')->default('public')->index(); + $table->timestamp('published_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('collections'); + } +} diff --git a/database/migrations/2018_09_30_051108_create_direct_messages_table.php b/database/migrations/2018_09_30_051108_create_direct_messages_table.php new file mode 100644 index 000000000..63b305f4d --- /dev/null +++ b/database/migrations/2018_09_30_051108_create_direct_messages_table.php @@ -0,0 +1,38 @@ +bigIncrements('id'); + $table->bigInteger('to_id')->unsigned()->index(); + $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->unique(['to_id', 'from_id', 'status_id']); + $table->timestamp('read_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('direct_messages'); + } +} diff --git a/database/migrations/2018_10_02_040917_create_collection_items_table.php b/database/migrations/2018_10_02_040917_create_collection_items_table.php new file mode 100644 index 000000000..fba5ced78 --- /dev/null +++ b/database/migrations/2018_10_02_040917_create_collection_items_table.php @@ -0,0 +1,35 @@ +bigIncrements('id'); + $table->bigInteger('collection_id')->unsigned()->index(); + $table->unsignedInteger('order')->nullable(); + $table->string('object_type')->default('post')->index(); + $table->bigInteger('object_id')->unsigned()->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('collection_items'); + } +} diff --git a/database/migrations/2018_10_09_043717_update_status_visibility_defaults.php b/database/migrations/2018_10_09_043717_update_status_visibility_defaults.php new file mode 100644 index 000000000..9c0dc3375 --- /dev/null +++ b/database/migrations/2018_10_09_043717_update_status_visibility_defaults.php @@ -0,0 +1,28 @@ + Date: Tue, 9 Oct 2018 19:20:09 -0600 Subject: [PATCH 07/21] Update thumbnail logic --- app/Util/Media/Image.php | 56 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/app/Util/Media/Image.php b/app/Util/Media/Image.php index a0a16f522..0c382258b 100644 --- a/app/Util/Media/Image.php +++ b/app/Util/Media/Image.php @@ -13,6 +13,10 @@ class Image public $portrait; public $thumbnail; public $orientation; + public $acceptedMimes = [ + 'image/png', + 'image/jpeg', + ]; public function __construct() { @@ -22,27 +26,27 @@ class Image $this->landscape = $this->orientations()['landscape']; $this->portrait = $this->orientations()['portrait']; $this->thumbnail = [ - 'width' => 293, - 'height' => 293, - ]; + 'width' => 640, + 'height' => 640, + ]; $this->orientation = null; } public function orientations() { return [ - 'square' => [ - 'width' => 1080, - 'height' => 1080, - ], - 'landscape' => [ - 'width' => 1920, - 'height' => 1080, - ], - 'portrait' => [ - 'width' => 1080, - 'height' => 1350, - ], + 'square' => [ + 'width' => 1080, + 'height' => 1080, + ], + 'landscape' => [ + 'width' => 1920, + 'height' => 1080, + ], + 'portrait' => [ + 'width' => 1080, + 'height' => 1350, + ], ]; } @@ -53,9 +57,9 @@ class Image } if ($thumbnail) { return [ - 'dimensions' => $this->thumbnail, - 'orientation' => 'thumbnail', - ]; + 'dimensions' => $this->thumbnail, + 'orientation' => 'thumbnail', + ]; } list($width, $height) = getimagesize($mediaPath); @@ -98,18 +102,22 @@ class Image { $path = $media->media_path; $file = storage_path('app/'.$path); + if (!in_array($media->mime, $this->acceptedMimes)) { + return; + } $ratio = $this->getAspectRatio($file, $thumbnail); $aspect = $ratio['dimensions']; $orientation = $ratio['orientation']; - if ($media->mime === 'image/gif' && !$thumbnail) { - return; - } try { $img = Intervention::make($file)->orientate(); - $img->resize($aspect['width'], $aspect['height'], function ($constraint) { - $constraint->aspectRatio(); - }); + if($thumbnail) { + $img->crop($aspect['width'], $aspect['height']); + } else { + $img->resize($aspect['width'], $aspect['height'], function ($constraint) { + $constraint->aspectRatio(); + }); + } $converted = $this->setBaseName($path, $thumbnail, $img->extension); $newPath = storage_path('app/'.$converted['path']); From 2876ec30d46508341eeaf1fa8ad79fbf610c4c62 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:21:45 -0600 Subject: [PATCH 08/21] Update Follower model, add permalink method --- app/Follower.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Follower.php b/app/Follower.php index 118495fe2..54eddd358 100644 --- a/app/Follower.php +++ b/app/Follower.php @@ -21,6 +21,12 @@ class Follower extends Model return $this->belongsTo(Profile::class, 'following_id', 'id'); } + public function permalink() + { + $path = $this->actor->permalink("/follow/{$this->id}"); + return url($path); + } + public function toText() { $actorName = $this->actor->username; From 614b951c5e29668c5854b8fc2883380f86f8af58 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:22:09 -0600 Subject: [PATCH 09/21] Update AccountController --- app/Http/Controllers/AccountController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index f7af111cf..2090f599e 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -64,12 +64,12 @@ class AccountController extends Controller ]); $profile = Auth::user()->profile; $action = $request->input('a'); - $timeago = Carbon::now()->subMonths(1); + $timeago = Carbon::now()->subMonths(3); $following = $profile->following->pluck('id'); $notifications = Notification::whereIn('actor_id', $following) ->where('profile_id', '!=', $profile->id) ->whereDate('created_at', '>', $timeago) - ->orderBy('notifications.id', 'desc') + ->orderBy('notifications.created_at', 'desc') ->simplePaginate(30); return view('account.following', compact('profile', 'notifications')); From 679a5664661180d656a760efb9a108cdc3b66805 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:23:42 -0600 Subject: [PATCH 10/21] Update TimelineController --- app/Http/Controllers/TimelineController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/TimelineController.php b/app/Http/Controllers/TimelineController.php index 58665fb0a..39094c033 100644 --- a/app/Http/Controllers/TimelineController.php +++ b/app/Http/Controllers/TimelineController.php @@ -29,6 +29,7 @@ class TimelineController extends Controller ->pluck('filterable_id'); $timeline = Status::whereIn('profile_id', $following) ->whereNotIn('profile_id', $filtered) + ->whereVisibility('public') ->orderBy('created_at', 'desc') ->withCount(['comments', 'likes']) ->simplePaginate(20); From 64f1118883e8adbb24707e3d64a6bc587e34fe16 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:24:42 -0600 Subject: [PATCH 11/21] Update Media model --- app/Media.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/Media.php b/app/Media.php index c1d36e558..592a684a1 100644 --- a/app/Media.php +++ b/app/Media.php @@ -32,4 +32,27 @@ class Media extends Model return url($url); } + + public function mimeType() + { + return explode('/', $this->mime)[0]; + } + + public function activityVerb() + { + $verb = 'Image'; + switch ($this->mimeType()) { + case 'image': + break; + + case 'video': + $verb = 'Video'; + break; + + default: + $verb = 'Document'; + break; + } + return $verb; + } } From bd685cf6f2d764ed135727a3075c35bf2a5944e3 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:25:27 -0600 Subject: [PATCH 12/21] Update Profile model, fix avatar caching bug --- app/Profile.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Profile.php b/app/Profile.php index b69bf74b9..4fe81c033 100644 --- a/app/Profile.php +++ b/app/Profile.php @@ -23,7 +23,7 @@ class Profile extends Model 'private_key', ]; - protected $visible = ['id', 'username', 'name']; + protected $visible = ['username', 'name']; public function user() { @@ -51,6 +51,10 @@ class Profile extends Model public function emailUrl() { + if($this->domain) { + return $this->username; + } + $domain = parse_url(config('app.url'), PHP_URL_HOST); return $this->username.'@'.$domain; @@ -137,7 +141,7 @@ class Profile extends Model { $url = Cache::remember("avatar:{$this->id}", 1440, function () { $path = optional($this->avatar)->media_path; - $version = hash('sha1', $this->avatar->created_at); + $version = hash('sha1', $this->avatar->updated_at); $path = "{$path}?v={$version}"; return url(Storage::url($path)); From bb4e63eb59335999d60bf6366f339be1ecfa4410 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:26:20 -0600 Subject: [PATCH 13/21] Update Status model --- app/Status.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Status.php b/app/Status.php index bfbdeb4e6..70095d3f6 100644 --- a/app/Status.php +++ b/app/Status.php @@ -18,6 +18,8 @@ class Status extends Model */ protected $dates = ['deleted_at']; + protected $fillable = ['profile_id', 'visibility']; + public function profile() { return $this->belongsTo(Profile::class); @@ -36,16 +38,21 @@ class Status extends Model public function viewType() { $media = $this->firstMedia(); - $type = explode('/', $media->mime); + $mime = explode('/', $media->mime)[0]; + $count = $this->media()->count(); + $type = ($mime == 'image') ? 'image' : 'video'; + if($count > 1) { + $type = ($type == 'image') ? 'album' : 'video-album'; + } - return $type[0]; + return $type; } public function thumb($showNsfw = false) { $type = $this->viewType(); $is_nsfw = !$showNsfw ? $this->is_nsfw : false; - if ($this->media->count() == 0 || $is_nsfw || $type != 'image') { + if ($this->media->count() == 0 || $is_nsfw || !in_array($type,['image', 'album'])) { return 'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=='; } From 25649c70cc19a94f71b62bbd8f097dd99177425b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:26:56 -0600 Subject: [PATCH 14/21] Update AccountTransformer --- app/Transformer/Api/AccountTransformer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Transformer/Api/AccountTransformer.php b/app/Transformer/Api/AccountTransformer.php index 5af4dfd62..45ff02564 100644 --- a/app/Transformer/Api/AccountTransformer.php +++ b/app/Transformer/Api/AccountTransformer.php @@ -23,8 +23,8 @@ class AccountTransformer extends Fractal\TransformerAbstract 'url' => $profile->url(), 'avatar' => $profile->avatarUrl(), 'avatar_static' => $profile->avatarUrl(), - 'header' => '', - 'header_static' => '', + 'header' => null, + 'header_static' => null, 'moved' => null, 'fields' => null, 'bot' => null, From d0d4def3ec2809a6e0518de8110e80930508c843 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:27:25 -0600 Subject: [PATCH 15/21] Update MediaTransformer --- app/Transformer/Api/MediaTransformer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Transformer/Api/MediaTransformer.php b/app/Transformer/Api/MediaTransformer.php index 81f49d6af..23c65fe81 100644 --- a/app/Transformer/Api/MediaTransformer.php +++ b/app/Transformer/Api/MediaTransformer.php @@ -11,7 +11,7 @@ class MediaTransformer extends Fractal\TransformerAbstract { return [ 'id' => $media->id, - 'type' => 'image', + 'type' => $media->activityVerb(), 'url' => $media->url(), 'remote_url' => null, 'preview_url' => $media->thumbnailUrl(), From 2202fc416a1c67d8df6e5593c311c1e44d60d773 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:28:11 -0600 Subject: [PATCH 16/21] Update User model, prepare for websockets --- app/User.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/User.php b/app/User.php index 7fba2c170..16d1b3078 100644 --- a/app/User.php +++ b/app/User.php @@ -35,7 +35,8 @@ class User extends Authenticatable protected $hidden = [ 'email', 'password', 'is_admin', 'remember_token', 'email_verified_at', '2fa_enabled', '2fa_secret', - '2fa_backup_codes', '2fa_setup_at', + '2fa_backup_codes', '2fa_setup_at', 'deleted_at', + 'updated_at' ]; public function profile() @@ -52,4 +53,9 @@ class User extends Authenticatable { return $this->hasOne(UserSetting::class); } + + public function receivesBroadcastNotificationsOn() + { + return 'App.User.'.$this->id; + } } From ad122aa8763b13bb29e6917bfa93d84f9faffa61 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:29:02 -0600 Subject: [PATCH 17/21] Update database config, dont run mysql in strict mode --- config/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.php b/config/database.php index 1b88fbad3..fb8136b3e 100644 --- a/config/database.php +++ b/config/database.php @@ -50,7 +50,7 @@ return [ 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', - 'strict' => true, + 'strict' => false, 'engine' => null, ], From 5089d50bf08e1f7119713295726206c6d21ba1ea Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:30:19 -0600 Subject: [PATCH 18/21] Add new localizations --- resources/lang/en/site.php | 16 ++++++++++++++++ resources/lang/fr/site.php | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 resources/lang/en/site.php create mode 100644 resources/lang/fr/site.php diff --git a/resources/lang/en/site.php b/resources/lang/en/site.php new file mode 100644 index 000000000..f0207615e --- /dev/null +++ b/resources/lang/en/site.php @@ -0,0 +1,16 @@ + 'About', + 'help' => 'Help', + 'language' => 'Language', + 'fediverse' => 'Fediverse', + 'opensource' => 'Open Source', + 'terms' => 'Terms', + 'privacy' => 'Privacy', + 'l10nWip' => 'We’re still working on localization support', + 'currentLocale' => 'Current locale', + 'selectLocale' => 'Select from one of the supported languages', + +]; \ No newline at end of file diff --git a/resources/lang/fr/site.php b/resources/lang/fr/site.php new file mode 100644 index 000000000..4514e3321 --- /dev/null +++ b/resources/lang/fr/site.php @@ -0,0 +1,16 @@ + 'Environ', + 'help' => 'Aidez-moi', + 'language' => 'La langue', + 'fediverse' => 'Fediverse', + 'opensource' => 'Open Source', + 'terms' => 'Termes', + 'privacy' => 'Intimité', + 'l10nWip' => 'Nous travaillons toujours sur le support de la localisation', + 'currentLocale' => 'Locale actuelle', + 'selectLocale' => 'Sélectionnez l\'une des langues prises en charge', + +]; \ No newline at end of file From 851c441319a4a67fed21da6fa192fbb019ebe157 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 11 Oct 2018 18:55:09 -0600 Subject: [PATCH 19/21] Update admin view --- resources/views/admin/home.blade.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/views/admin/home.blade.php b/resources/views/admin/home.blade.php index 5cc59d605..c8cf6e620 100644 --- a/resources/views/admin/home.blade.php +++ b/resources/views/admin/home.blade.php @@ -30,30 +30,33 @@ + @php($reports = App\Report::whereNull('admin_seen')->count())
-

{{App\Util\Lexer\PrettyNumber::convert(App\Report::whereNull('admin_seen')->count())}}

+

{{App\Util\Lexer\PrettyNumber::convert($reports)}}

Reports

+ @php($statuses = App\Status::whereNull('in_reply_to_id')->whereNull('reblog_of_id')->count())
-

{{App\Util\Lexer\PrettyNumber::convert(App\Status::whereNull('in_reply_to_id')->whereNull('reblog_of_id')->count())}}

+

{{App\Util\Lexer\PrettyNumber::convert($statuses)}}

Statuses

+ @php($replies = App\Status::whereNotNull('in_reply_to_id')->count())
-

{{App\Util\Lexer\PrettyNumber::convert(App\Status::whereNotNull('in_reply_to_id')->count())}}

+

{{App\Util\Lexer\PrettyNumber::convert($replies)}}

Replies

From 4688e6c6054bdf9a8980a345420f33e6bb6a26f2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 16 Oct 2018 12:31:29 -0600 Subject: [PATCH 20/21] Update Media model --- app/Media.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Media.php b/app/Media.php index 592a684a1..55cdd854f 100644 --- a/app/Media.php +++ b/app/Media.php @@ -55,4 +55,9 @@ class Media extends Model } return $verb; } + + public function getMetadata() + { + return json_decode($this->metadata, true, 3); + } } From 8c111d22c6120e7a35fd140acdc6e3d42542a4bb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 16 Oct 2018 15:36:08 -0600 Subject: [PATCH 21/21] Update StatusController --- app/Http/Controllers/StatusController.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index 04c42747e..77962b1be 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -22,6 +22,7 @@ class StatusController extends Controller $user = Profile::whereUsername($username)->firstOrFail(); $status = Status::whereProfileId($user->id) + ->where('visibility', '!=', 'draft') ->withCount(['likes', 'comments', 'media']) ->findOrFail($id); @@ -41,7 +42,7 @@ class StatusController extends Controller $template = $this->detectTemplate($status); - $replies = Status::whereInReplyToId($status->id)->simplePaginate(30); + $replies = Status::whereInReplyToId($status->id)->orderBy('created_at', 'desc')->simplePaginate(30); return view($template, compact('user', 'status', 'replies')); } @@ -59,6 +60,9 @@ class StatusController extends Controller if ($status->viewType() == 'video') { $template = 'status.show.video'; } + if ($status->viewType() == 'video-album') { + $template = 'status.show.video-album'; + } return $template; }); @@ -85,13 +89,7 @@ class StatusController extends Controller } $this->validate($request, [ - 'photo.*' => function() { - return [ - 'required', - 'mimes:' . config('pixelfed.media_types'), - 'max:' . config('pixelfed.max_photo_size'), - ]; - }, + 'photo.*' => 'required|mimetypes:' . config('pixelfed.media_types').'|max:' . config('pixelfed.max_photo_size'), 'caption' => 'string|max:'.config('pixelfed.max_caption_length'), 'cw' => 'nullable|string', 'filter_class' => 'nullable|string',