Commit 451468d1 authored by Mario's avatar Mario
Browse files

fix mod item issue with remote channels

parent c0adf31d
......@@ -300,6 +300,7 @@ class Item extends Controller {
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0);
$parent_mid = ((x($_REQUEST,'parent_mid')) ? trim($_REQUEST['parent_mid']) : '');
$mode = (($_REQUEST['conv_mode'] === 'channel') ? 'channel' : 'network');
$remote_xchan = ((x($_REQUEST,'remote_xchan')) ? trim($_REQUEST['remote_xchan']) : false);
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
......@@ -1374,24 +1375,19 @@ class Item extends Controller {
goaway(z_root() . "/" . $return_path);
}
if($mode === 'channel')
profile_load($owner_xchan['xchan_name']);
if(local_channel()) {
$item[] = $datarray;
$item[0]['owner'] = $owner_xchan;
$item[0]['author'] = $observer;
$item[0]['attach'] = json_encode($datarray['attach']);
$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'),
];
}
else {
$json = [
'success' => 1
];
}
$json = [
'success' => 1,
'id' => $post_id,
'html' => conversation($item,$mode,true,'r_preview'),
];
if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
$json['reload'] = z_root() . '/' . $_REQUEST['jsreload'];
......
......@@ -1371,25 +1371,25 @@ function post_comment(id) {
$('body').css('cursor', 'wait');
$("#comment-preview-inp-" + id).val("0");
if(typeof conv_mode == typeof undefined)
conv_mode = '';
var form_data = $("#comment-edit-form-" + id).serialize();
$.post(
"item",
$("#comment-edit-form-" + id).serialize(),
form_data + '&conv_mode=' + conv_mode,
function(data) {
if(data.success) {
localStorage.removeItem("comment_body-" + id);
$("#comment-edit-preview-" + id).hide();
$("#comment-edit-text-" + id).val('').blur().attr('placeholder', aStr.comment);
if(! localUser) {
updateInit();
}
else {
$('#wall-item-comment-wrapper-' + id).before(data.html);
$('#wall-item-ago-' + data.id + ' .autotime').timeago();
$('body').css('cursor', 'unset');
collapseHeight();
commentBusy = false;
}
$('#wall-item-comment-wrapper-' + id).before(data.html);
$('#wall-item-ago-' + data.id + ' .autotime').timeago();
$('body').css('cursor', 'unset');
collapseHeight();
commentBusy = false;
var tarea = document.getElementById("comment-edit-text-" + id);
if(tarea) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment