aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/Enotify.php3
-rw-r--r--Zotlabs/Lib/ThreadItem.php14
-rw-r--r--Zotlabs/Module/Display.php3
-rw-r--r--Zotlabs/Module/Hq.php4
-rw-r--r--include/conversation.php3
-rw-r--r--view/js/main.js46
-rwxr-xr-xview/tpl/conv_item.tpl2
7 files changed, 65 insertions, 10 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index de2bfba24..c1a6c9fdc 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -845,7 +845,8 @@ class Enotify {
'photo' => $item[$who]['xchan_photo_s'],
'when' => (($edit) ? datetime_convert('UTC', date_default_timezone_get(), $item['edited']) : datetime_convert('UTC', date_default_timezone_get(), $item['created'])),
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
- 'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? 'b64.' . base64url_encode($item['thr_parent']) : 'b64.' . base64url_encode($item['mid'])),
+ 'b64mid' => 'b64.' . base64url_encode($item['mid']),
+ //'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? 'b64.' . base64url_encode($item['thr_parent']) : 'b64.' . base64url_encode($item['mid'])),
'notify_id' => 'undefined',
'thread_top' => (($item['item_thread_top']) ? true : false),
'message' => strip_tags(bbcode($itemem_text)),
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 174af7f0e..0f59953dc 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -78,7 +78,7 @@ class ThreadItem {
*/
public function get_template_data($conv_responses, $thread_level=1, $conv_flags = []) {
-
+
$result = array();
$item = $this->get_data();
@@ -356,6 +356,17 @@ class ThreadItem {
call_hooks('dropdown_extras',$dropdown_extras_arr);
$dropdown_extras = $dropdown_extras_arr['dropdown_extras'];
+ $mids = ['b64.' . base64url_encode($item['mid'])];
+ $response_mids = [];
+ foreach($response_verbs as $v) {
+ if(isset($conv_responses[$v]['mids'][$item['mid']])) {
+ $response_mids = array_merge($response_mids, $conv_responses[$v]['mids'][$item['mid']]);
+ }
+ }
+
+ $mids = array_merge($mids, $response_mids);
+ $json_mids = json_encode($mids);
+
$tmp_item = array(
'template' => $this->get_template(),
'mode' => $mode,
@@ -370,6 +381,7 @@ class ThreadItem {
'text' => strip_tags($body['html']),
'id' => $this->get_id(),
'mid' => 'b64.' . base64url_encode($item['mid']),
+ 'mids' => $json_mids,
'parent' => $item['parent'],
'author_id' => (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']),
'isevent' => $isevent,
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 5983578b3..cf38aba1a 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -200,7 +200,8 @@ class Display extends \Zotlabs\Web\Controller {
// if the target item is not a post (eg a like) we want to address its thread parent
- $mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
+ //$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
+ $mid = $target_item['mid'];
// if we got a decoded hash we must encode it again before handing to javascript
if($decoded)
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 848fe3e25..d8c540fb9 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -152,8 +152,8 @@ class Hq extends \Zotlabs\Web\Controller {
if($target_item) {
// if the target item is not a post (eg a like) we want to address its thread parent
- $mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
-
+ //$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
+ $mid = $target_item['mid'];
// if we got a decoded hash we must encode it again before handing to javascript
if($decoded)
$mid = 'b64.' . base64url_encode($mid);
diff --git a/include/conversation.php b/include/conversation.php
index e2dd02ffc..95eb1daad 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1172,6 +1172,9 @@ function builtin_activity_puller($item, &$conv_responses) {
if(! $item['thr_parent'])
$item['thr_parent'] = $item['parent_mid'];
+
+ $conv_responses[$mode]['mids'][$item['thr_parent']][] = 'b64.' . base64url_encode($item['mid']);
+
if(! ((isset($conv_responses[$mode][$item['thr_parent'] . '-l']))
&& (is_array($conv_responses[$mode][$item['thr_parent'] . '-l']))))
$conv_responses[$mode][$item['thr_parent'] . '-l'] = array();
diff --git a/view/js/main.js b/view/js/main.js
index f88153d9b..29a95d9b1 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -849,10 +849,23 @@ function updateConvItems(mode,data) {
// take care of the notifications count updates
$('.thread-wrapper', data).each(function() {
- var nmid = $(this).data('b64mid');
+ //var nmid = $(this).data('b64mid');
+ var nmids = $(this).data('b64mids');
- sse_mids.push(nmid);
+ console.log(nmids);
+ nmids.forEach(function (nmid, index) {
+ sse_mids.push(nmid);
+ if($('.notification[data-b64mid=\'' + nmid + '\']').length) {
+ $('.notification[data-b64mid=\'' + nmid + '\']').each(function() {
+ var n = this.parentElement.id.split('-');
+ return sse_updateNotifications(n[1], nmid, true);
+ });
+ sse_mids = [];
+ }
+ });
+
+/*
if($('.notification[data-b64mid=\'' + nmid + '\']').length) {
$('.notification[data-b64mid=\'' + nmid + '\']').each(function() {
var n = this.parentElement.id.split('-');
@@ -860,9 +873,10 @@ function updateConvItems(mode,data) {
});
sse_mids = [];
}
-
+*/
});
+
// reset rotators and cursors we may have set before reaching this place
$('.like-rotator').hide();
@@ -929,6 +943,22 @@ function scrollToItem() {
var encoded = ((submid.substr(0,4) == 'b64.') ? true : false);
var submid_encoded = ((encoded) ? submid : window.btoa(submid));
+ $('.thread-wrapper').filter(function() {
+ if($(this).data('b64mids').indexOf(submid_encoded) > -1 && !$(this).hasClass('toplevel_item')) {
+ if($('.collapsed-comments').length) {
+ var scrolltoid = $('.collapsed-comments').attr('id').substring(19);
+ $('#collapsed-comments-' + scrolltoid + ' .autotime').timeago();
+ $('#collapsed-comments-' + scrolltoid).show();
+ $('#hide-comments-' + scrolltoid).html(aStr.showfewer);
+ $('#hide-comments-total-' + scrolltoid).hide();
+ }
+ $('html, body').animate({ scrollTop: $(this).offset().top - $('nav').outerHeight(true) }, 'slow');
+ $(this).addClass('item-highlight');
+ }
+
+ });
+
+/*
if($('.thread-wrapper[data-b64mid=\'' + submid_encoded + '\']').length && !$('.thread-wrapper[data-b64mid=\'' + submid_encoded + '\']').hasClass('toplevel_item')) {
if($('.collapsed-comments').length) {
var scrolltoid = $('.collapsed-comments').attr('id').substring(19);
@@ -940,6 +970,7 @@ function scrollToItem() {
$('html, body').animate({ scrollTop: $('.thread-wrapper[data-b64mid=\'' + submid_encoded + '\']').offset().top - $('nav').outerHeight(true) }, 'slow');
$('.thread-wrapper[data-b64mid=\'' + submid_encoded + '\']').addClass('item-highlight');
}
+*/
}
function collapseHeight() {
@@ -1275,6 +1306,7 @@ function doreply(parent, ident, owner, hint) {
}
function doscroll(parent, hidden) {
+ var id;
var x = '#hide-comments-outer-' + hidden.toString();
var back = $('#back-to-reply');
if(back.length == 0)
@@ -1290,7 +1322,13 @@ function doscroll(parent, hidden) {
}
}
back.remove();
- var id = $('[data-b64mid="' + parent + '"]');
+
+ $('.thread-wrapper').filter(function() {
+ if($(this).data('b64mids').indexOf(parent) > -1) {
+ id = $(this);
+ }
+ });
+
$('html, body').animate({scrollTop:(id.offset().top) - 50}, 'slow');
$('<a href="javascript:doscrollback(' + pos + ');" id="back-to-reply" class="float-right" title="' + aStr['to_reply'] + '"><i class="fa fa-angle-double-down">&nbsp;&nbsp;&nbsp;</i></a>').insertBefore('#wall-item-info-' + id.attr('id').replace(/\D/g,''));
}
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index f639683b8..6ae24a487 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -4,7 +4,7 @@
</div>
<div id="collapsed-comments-{{$item.id}}" class="collapsed-comments" style="display: none;">
{{/if}}
- <div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper h-entry {{else}} u-comment h-cite{{/if}}" data-b64mid="{{$item.mid}}">
+ <div id="thread-wrapper-{{$item.id}}" class="thread-wrapper{{if $item.toplevel}} {{$item.toplevel}} generic-content-wrapper h-entry {{else}} u-comment h-cite{{/if}}" data-b64mids='{{$item.mids}}'>
<a name="item_{{$item.id}}" ></a>
<div class="wall-item-outside-wrapper{{if $item.is_comment}} comment{{/if}}{{if $item.previewing}} preview{{/if}}" id="wall-item-outside-wrapper-{{$item.id}}" >
<div class="clearfix wall-item-content-wrapper{{if $item.is_comment}} comment{{/if}}" id="wall-item-content-wrapper-{{$item.id}}">