diff options
-rw-r--r-- | Zotlabs/Module/Like.php | 4 | ||||
-rw-r--r-- | view/js/main.js | 18 |
2 files changed, 8 insertions, 14 deletions
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 538282c38..638ec6a78 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -387,6 +387,7 @@ class Like extends \Zotlabs\Web\Controller { $json = [ 'success' => 1, + 'orig_id' => $item_id, 'id' => $item['id'], 'html' => conversation($convitems,'network',true,'r_preview'), ]; @@ -534,8 +535,6 @@ class Like extends \Zotlabs\Web\Controller { $post = item_store($arr); $post_id = $post['item_id']; - //$item[] = $item; - $item_normal = item_normal(); $activities = q("SELECT item.*, item.id AS item_id FROM item WHERE uid = %d $item_normal @@ -555,6 +554,7 @@ class Like extends \Zotlabs\Web\Controller { $json = [ 'success' => 1, + 'orig_id' => $item_id, //this is required for pubstream where $item_id != $item['id'] 'id' => $item['id'], 'html' => conversation($convitems,'network',true,'r_preview'), ]; diff --git a/view/js/main.js b/view/js/main.js index 133d71863..b7cfb75db 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1146,27 +1146,21 @@ function justifyPhotosAjax(id) { $('#' + id).justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; }); } -// Since our ajax calls are asynchronous, we will give a few -// seconds for the first ajax call (setting like/dislike), then -// run the updater to pick up any changes and display on the page. -// The updater will turn any rotators off when it's done. -// This function will have returned long before any of these -// events have completed and therefore there won't be any -// visible feedback that anything changed without all this -// trickery. This still could cause confusion if the "like" ajax call -// is delayed and updateInit runs before it completes. function dolike(ident, verb) { $('#like-rotator-' + ident.toString()).show(); $.get('like/' + ident.toString() + '?verb=' + verb, function (data) { data = JSON.parse(data); if(data.success) { // this is a bit tricky since the top level thread wrapper wraps the whole thread - if($('#thread-wrapper-' + data.id).hasClass('toplevel_item')) { + if($('#thread-wrapper-' + data.orig_id).hasClass('toplevel_item')) { var wrapper = $('<div></div>').html( data.html ).find('#wall-item-outside-wrapper-' + data.id); - $('#wall-item-outside-wrapper-' + data.id).html(wrapper[0].innerHTML); + $('#wall-item-outside-wrapper-' + data.orig_id).html(wrapper[0].innerHTML); + // those were not replaced - swap the id + $('#thread-wrapper-' + data.orig_id).attr('id', 'thread-wrapper-' + data.id); + $('#wall-item-outside-wrapper-' + data.orig_id).attr('id', 'wall-item-outside-wrapper-' + data.id); } else { - $('#thread-wrapper-' + data.id).replaceWith(data.html); + $('#thread-wrapper-' + data.orig_id).replaceWith(data.html); } $('#wall-item-ago-' + data.id + ' .autotime').timeago(); liking = 0; |