Commit f74cfaec authored by Mario's avatar Mario
Browse files

fix pubstream id issue

parent d559b4a2
Pipeline #364834 passed with stage
in 5 minutes and 26 seconds
......@@ -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'),
];
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment