Browse Source

Update timeline logic to sort by date instead of id

Daniel Supernault 6 years ago
parent
commit
197829224e

+ 1 - 1
app/Http/Controllers/SiteController.php

@@ -43,7 +43,7 @@ class SiteController extends Controller
                   ->whereNotIn('profile_id', $filtered)
                   ->whereNotIn('profile_id', $filtered)
                   ->whereHas('media')
                   ->whereHas('media')
                   ->whereVisibility('public')
                   ->whereVisibility('public')
-                  ->orderBy('id', 'desc')
+                  ->orderBy('created_at', 'desc')
                   ->withCount(['comments', 'likes', 'shares'])
                   ->withCount(['comments', 'likes', 'shares'])
                   ->simplePaginate(20);
                   ->simplePaginate(20);
         $type = 'personal';
         $type = 'personal';

+ 2 - 2
app/Http/Controllers/TimelineController.php

@@ -28,7 +28,7 @@ class TimelineController extends Controller
                   ->pluck('filterable_id');
                   ->pluck('filterable_id');
         $timeline = Status::whereIn('profile_id', $following)
         $timeline = Status::whereIn('profile_id', $following)
                   ->whereNotIn('profile_id', $filtered)
                   ->whereNotIn('profile_id', $filtered)
-                  ->orderBy('id', 'desc')
+                  ->orderBy('created_at', 'desc')
                   ->withCount(['comments', 'likes'])
                   ->withCount(['comments', 'likes'])
                   ->simplePaginate(20);
                   ->simplePaginate(20);
         $type = 'personal';
         $type = 'personal';
@@ -54,7 +54,7 @@ class TimelineController extends Controller
                   ->whereNull('reblog_of_id')
                   ->whereNull('reblog_of_id')
                   ->whereVisibility('public')
                   ->whereVisibility('public')
                   ->withCount(['comments', 'likes'])
                   ->withCount(['comments', 'likes'])
-                  ->orderBy('id', 'desc')
+                  ->orderBy('created_at', 'desc')
                   ->simplePaginate(20);
                   ->simplePaginate(20);
         $type = 'local';
         $type = 'local';