1
0
Эх сурвалжийг харах

Fix pagination bug for like and comment events

Daniel Supernault 7 жил өмнө
parent
commit
4751832ad3

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

@@ -24,9 +24,9 @@ class ApiController extends Controller
 
         $likes = Like::whereProfileId($profile->id)
                  ->orderBy('id', 'desc')
-                 ->take(100)
+                 ->take(1000)
                  ->pluck('status_id');
-                 
+
         return response()->json($likes);
     }
 }

BIN
public/js/app.js


BIN
public/js/timeline.js


BIN
public/mix-manifest.json


+ 1 - 0
resources/assets/js/bootstrap.js

@@ -9,6 +9,7 @@ window.Popper = require('popper.js').default;
  */
 
 try {
+    window.pixelfed = {};
     window.$ = window.jQuery = require('jquery');
     require('bootstrap');
     window.InfiniteScroll = require('infinite-scroll');

+ 1 - 1
resources/assets/js/components/commentform.js

@@ -5,7 +5,7 @@ $(document).ready(function() {
     el.focus();
   });
 
-  $('.comment-form').submit(function(e, data) {
+  $(document).on('submit', '.comment-form', function(e, data) {
     e.preventDefault();
 
     let el = $(this);

+ 5 - 4
resources/assets/js/components/likebutton.js

@@ -11,9 +11,8 @@ $(document).ready(function() {
     })
   }
 
-  hydrateLikes();
 
-  function hydrateLikes() {
+  pixelfed.hydrateLikes = function() {
     var likes = ls.get('likes');
     $('.like-form').each(function(i, el) {
       var el = $(el);
@@ -24,9 +23,11 @@ $(document).ready(function() {
         heart.addClass('fas fa-heart').removeClass('far fa-heart');
       }
     });
-  }
+  };
+
+  pixelfed.hydrateLikes();
 
-  $('.like-form').submit(function(e) {
+  $(document).on('submit', '.like-form', function(e) {
     e.preventDefault();
     var el = $(this);
     var id = el.data('id');

+ 3 - 0
resources/assets/js/timeline.js

@@ -6,4 +6,7 @@ $(document).ready(function() {
     append: '.timeline-feed',
     history: false,
   });
+  infScroll.on( 'append', function( response, path, items ) {
+    pixelfed.hydrateLikes();
+  });
 });