From c0adf31da9a0d8f897dc68ab632c736891318ad5 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 22 Nov 2020 13:07:03 +0000 Subject: fix like issue with remote channels --- view/js/main.js | 44 +++++++++++++++++++++----------------------- view/tpl/build_query.tpl | 3 +++ 2 files changed, 24 insertions(+), 23 deletions(-) (limited to 'view') diff --git a/view/js/main.js b/view/js/main.js index 0bc4261f5..4c8cd0adf 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1149,30 +1149,28 @@ function justifyPhotosAjax(id) { function dolike(ident, verb) { $('#like-rotator-' + ident.toString()).show(); - if(! localUser) { - $.get('like/' + ident.toString() + '?verb=' + verb, updateInit); - } - else { - $.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.orig_id).hasClass('toplevel_item')) { - var wrapper = $('
').html( data.html ).find('#wall-item-outside-wrapper-' + data.id); - $('#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.orig_id).replaceWith(data.html); - } - $('#wall-item-ago-' + data.id + ' .autotime').timeago(); - collapseHeight(); - liking = 0; + if(typeof conv_mode == typeof undefined) + conv_mode = ''; + + $.get('like/' + ident.toString() + '?verb=' + verb + '&conv_mode=' + conv_mode, 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.orig_id).hasClass('toplevel_item')) { + var wrapper = $('
').html( data.html ).find('#wall-item-outside-wrapper-' + data.id); + $('#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.orig_id).replaceWith(data.html); + } + $('#wall-item-ago-' + data.id + ' .autotime').timeago(); + collapseHeight(); + liking = 0; + } + }); liking = 1; } diff --git a/view/tpl/build_query.tpl b/view/tpl/build_query.tpl index 69c5e301f..83e756367 100755 --- a/view/tpl/build_query.tpl +++ b/view/tpl/build_query.tpl @@ -2,6 +2,9 @@ var bParam_cmd = "{{$baseurl}}/update/{{$pgtype}}"; + {{if $conv_mode}} + var conv_mode = '{{$conv_mode}}'; + {{/if}} var bParam_uid = {{$uid}}; var bParam_gid = {{$gid}}; -- cgit v1.2.3