diff options
-rw-r--r-- | Zotlabs/Module/Item.php | 14 | ||||
-rw-r--r-- | include/conversation.php | 5 | ||||
-rw-r--r-- | view/js/main.js | 13 | ||||
-rwxr-xr-x | view/tpl/conv_item.tpl | 2 |
4 files changed, 26 insertions, 8 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 922a2ef06..66c18fefd 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1373,8 +1373,18 @@ class Item extends Controller { if($return_path) { goaway(z_root() . "/" . $return_path); } - - $json = array('success' => 1); + + $item[] = $datarray; + $item[0]['owner'] = $owner_xchan; + $item[0]['author'] = $observer; + $item[0]['attach'] = json_encode($datarray['attach']); + + $json = [ + 'success' => 1, + 'id' => $post_id, + 'html' => conversation($item,'network',true,'r_preview'), + ]; + if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) $json['reload'] = z_root() . '/' . $_REQUEST['jsreload']; diff --git a/include/conversation.php b/include/conversation.php index e77404cff..6615b04c3 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -511,6 +511,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $jsreload = ''; $preview = (($page_mode === 'preview') ? true : false); + $r_preview = (($page_mode === 'r_preview') ? true : false); $previewing = (($preview) ? ' preview ' : ''); $preview_lbl = t('This is an unsaved preview'); @@ -873,11 +874,13 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa } + $item['pagedrop'] = $page_dropping; - if($item['id'] == $item['parent']) { + if($item['id'] == $item['parent'] || $r_preview) { $item_object = new Zotlabs\Lib\ThreadItem($item); + $conv->add_thread($item_object); if(($page_mode === 'list') || ($page_mode === 'pager_list')) { $item_object->set_template('conv_list.tpl'); diff --git a/view/js/main.js b/view/js/main.js index 09afb4da4..380b2bbf7 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1364,15 +1364,20 @@ function post_comment(id) { if(data.success) { localStorage.removeItem("comment_body-" + id); $("#comment-edit-preview-" + id).hide(); - $("#comment-edit-wrapper-" + id).hide(); - $("#comment-edit-text-" + id).val(''); + //$("#comment-edit-wrapper-" + id).hide(); + + $("#comment-edit-text-" + id).val('').blur().attr('placeholder', aStr.comment); var tarea = document.getElementById("comment-edit-text-" + id); if(tarea) { commentClose(tarea, id); $(document).unbind( "click.commentOpen"); } - if(timer) clearTimeout(timer); - timer = setTimeout(updateInit, 500); + + $('#wall-item-comment-wrapper-' + id).before(data.html); + $('#wall-item-ago-' + data.id + ' .autotime').timeago(); + $('body').css('cursor', 'unset'); + //if(timer) clearTimeout(timer); + //timer = setTimeout(updateInit, 500); } if(data.reload) { window.location.href=data.reload; diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index d7eaefe7e..78601c40d 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -259,7 +259,7 @@ {{/foreach}} {{/if}} {{if $item.comment}} - <div class="p-2 wall-item-comment-wrapper{{if $item.children}} wall-item-comment-wrapper-wc{{/if}}" > + <div id="wall-item-comment-wrapper-{{$item.id}}" class="p-2 wall-item-comment-wrapper{{if $item.children}} wall-item-comment-wrapper-wc{{/if}}" > {{$item.comment}} </div> {{/if}} |