Issue #316 make /display updates work. Basically copy and paste what we do on load and add $simple_update to the query.
This commit is contained in:
parent
843cc1481a
commit
c2cdd41e81
@ -689,7 +689,7 @@ class Item extends BaseObject {
|
|||||||
$comment_box = replace_macros($template,array(
|
$comment_box = replace_macros($template,array(
|
||||||
'$return_path' => '',
|
'$return_path' => '',
|
||||||
'$threaded' => $this->is_threaded(),
|
'$threaded' => $this->is_threaded(),
|
||||||
'$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
|
'$jsreload' => '', //(($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
|
||||||
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
|
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
|
||||||
'$id' => $this->get_id(),
|
'$id' => $this->get_id(),
|
||||||
'$parent' => $this->get_id(),
|
'$parent' => $this->get_id(),
|
||||||
|
@ -116,7 +116,7 @@ function display_content(&$a, $update = 0, $load = false) {
|
|||||||
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
|
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
|
||||||
|
|
||||||
if($update && $_SESSION['loadtime'])
|
if($update && $_SESSION['loadtime'])
|
||||||
$simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ";
|
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
|
||||||
if($load)
|
if($load)
|
||||||
$simple_update = '';
|
$simple_update = '';
|
||||||
|
|
||||||
@ -217,9 +217,54 @@ function display_content(&$a, $update = 0, $load = false) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
$r = array();
|
|
||||||
|
elseif($update && !$load) {
|
||||||
|
$r = null;
|
||||||
|
|
||||||
|
require_once('include/identity.php');
|
||||||
|
$sys = get_sys_channel();
|
||||||
|
$sysid = $sys['channel_id'];
|
||||||
|
|
||||||
|
if(local_channel()) {
|
||||||
|
$r = q("SELECT * from item
|
||||||
|
WHERE uid = %d
|
||||||
|
and mid = '%s'
|
||||||
|
$item_normal
|
||||||
|
$simple_update
|
||||||
|
limit 1",
|
||||||
|
intval(local_channel()),
|
||||||
|
dbesc($target_item['parent_mid'])
|
||||||
|
);
|
||||||
|
if($r) {
|
||||||
|
$updateable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if($r === null) {
|
||||||
|
// in case somebody turned off public access to sys channel content using permissions
|
||||||
|
// make that content unsearchable by ensuring the owner_xchan can't match
|
||||||
|
if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
|
||||||
|
$sysid = 0;
|
||||||
|
|
||||||
|
$r = q("SELECT * from item
|
||||||
|
WHERE mid = '%s'
|
||||||
|
AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = ''
|
||||||
|
AND `item`.`deny_gid` = '' AND item_private = 0 )
|
||||||
|
and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
|
||||||
|
OR uid = %d )
|
||||||
|
$sql_extra )
|
||||||
|
$item_normal
|
||||||
|
$simple_update
|
||||||
|
limit 1",
|
||||||
|
dbesc($target_item['parent_mid']),
|
||||||
|
intval($sysid)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$_SESSION['loadtime'] = datetime_convert();
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
$r = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
|
Reference in New Issue
Block a user