32 characters are often not enough to distinguish gnu-social mids - use the entire mid. in /display if we are not dealing with posts (eg likes) provide the thr_parent mid as bParam_mid so we can still adress the right post in javascript
This commit is contained in:
		| @@ -413,7 +413,7 @@ class ThreadItem { | ||||
| 			'previewing' => ($conv->is_preview() ? true : false ), | ||||
| 			'preview_lbl' => t('This is an unsaved preview'), | ||||
| 			'wait' => t('Please wait'), | ||||
| 			'submid' => str_replace(['+','='], ['',''], base64_encode(substr($item['mid'],0,32))), | ||||
| 			'submid' => str_replace(['+','='], ['',''], base64_encode($item['mid'])), | ||||
| 			'thread_level' => $thread_level | ||||
| 		); | ||||
|  | ||||
|   | ||||
| @@ -89,7 +89,7 @@ class Display extends \Zotlabs\Web\Controller { | ||||
| 		if($decoded) | ||||
| 			$item_hash = $decoded; | ||||
|  | ||||
| 		$r = q("select id, uid, mid, parent_mid, item_type, item_deleted from item where mid like '%s' limit 1", | ||||
| 		$r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted from item where mid like '%s' limit 1", | ||||
| 			dbesc($item_hash . '%') | ||||
| 		); | ||||
| 	 | ||||
| @@ -165,7 +165,8 @@ class Display extends \Zotlabs\Web\Controller { | ||||
| 				'$dend' => '', | ||||
| 				'$dbegin' => '', | ||||
| 				'$verb' => '', | ||||
| 				'$mid' => $item_hash | ||||
| 				//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']) | ||||
| 			)); | ||||
|  | ||||
| 			head_add_link([  | ||||
|   | ||||
| @@ -698,9 +698,9 @@ 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,  | ||||
| 	// substr(0,32) + base64_encode + replace(['+','='],['','']); | ||||
| 	// base64_encode + replace(['+','='],['','']); | ||||
| 	var submid = bParam_mid; | ||||
| 	var submid_encoded = ((submid.length) ? submid.substring(0,32) : 'abcdefg'); | ||||
| 	var submid_encoded = ((submid.length) ? submid : 'abcdefg'); | ||||
| 	submid_encoded = window.btoa(submid_encoded); | ||||
| 	submid_encoded = submid_encoded.replace(/[\+\=]/g,''); | ||||
| 	if($('.item_' + submid_encoded).length && !$('.item_' + submid_encoded).hasClass('toplevel_item') && mode == 'replace') { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user