diff options
-rw-r--r-- | Zotlabs/Module/Display.php | 13 | ||||
-rw-r--r-- | install/schema_mysql.sql | 2 | ||||
-rw-r--r-- | install/update.php | 2 | ||||
-rw-r--r-- | view/js/main.js | 8 |
4 files changed, 17 insertions, 8 deletions
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 11c75219d..0ea55102e 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -133,7 +133,14 @@ class Display extends \Zotlabs\Web\Controller { if((! $update) && (! $load)) { $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); - + + //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']); + + //if we got a decoded hash we must encode it again before handing to javascript + if($decoded) + $mid = 'b64.' . base64url_encode($mid); + $o .= '<div id="live-display"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1)) . "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] . "; </script>\r\n"; @@ -165,8 +172,7 @@ class Display extends \Zotlabs\Web\Controller { '$dend' => '', '$dbegin' => '', '$verb' => '', - //if the target item is not a post (eg a like) want to address its thread parent - '$mid' => (($target_item['verb'] == ACTIVITY_POST) ? $item_hash : $target_item['thr_parent']) + '$mid' => $mid )); head_add_link([ @@ -323,6 +329,7 @@ class Display extends \Zotlabs\Web\Controller { $r = q("SELECT id, item_deleted FROM item WHERE mid = '%s' LIMIT 1", dbesc($item_hash) ); + if($r) { if(intval($r[0]['item_deleted'])) { notice( t('Item has been removed.') . EOL ); diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index a9950ce21..0988bfa4a 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -652,7 +652,7 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `received` (`received`), KEY `uid_commented` (`uid`, `commented`), KEY `uid_created` (`uid`, `created`), - KEY `uid_item_unseen` (`uid`, `item_unseen`); + KEY `uid_item_unseen` (`uid`, `item_unseen`), KEY `aid` (`aid`), KEY `owner_xchan` (`owner_xchan`), KEY `author_xchan` (`author_xchan`), diff --git a/install/update.php b/install/update.php index b99e4dd9d..ce9a50913 100644 --- a/install/update.php +++ b/install/update.php @@ -2985,7 +2985,7 @@ function update_r1193() { $r1 = q("CREATE INDEX item_uid_unseen ON item (uid, item_unseen)"); } else { - $r1 = q("ALTER TABLE item ADD INDEX uid_item_unseen (uid, item_unseen);"); + $r1 = q("ALTER TABLE item ADD INDEX uid_item_unseen (uid, item_unseen)"); } if($r1) diff --git a/view/js/main.js b/view/js/main.js index ce7a1a07e..cdba8a25d 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -699,9 +699,11 @@ function updateConvItems(mode,data) { // auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode // use the same method to generate the submid as we use in ThreadItem, // base64_encode + replace(['+','='],['','']); - var submid = bParam_mid; - var submid_encoded = ((submid.length) ? submid : 'abcdefg'); - submid_encoded = window.btoa(submid_encoded); + + var submid = ((bParam_mid.length) ? bParam_mid : 'abcdefg'); + var encoded = ((submid.substr(0,4) == 'b64.') ? true : false); + var submid_encoded = ((encoded) ? submid.substr(4) : window.btoa(submid)); + submid_encoded = submid_encoded.replace(/[\+\=]/g,''); if($('.item_' + submid_encoded).length && !$('.item_' + submid_encoded).hasClass('toplevel_item') && mode == 'replace') { if($('.collapsed-comments').length) { |