Follow up: Display update should really be fixed now.
This commit is contained in:
parent
b1a9030369
commit
e28819655c
1 changed files with 18 additions and 14 deletions
|
@ -211,13 +211,14 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
$item_id = $_REQUEST['item_id'];
|
$item_id = $_REQUEST['item_id'];
|
||||||
$item = dba::selectFirst('item', ['uid', 'parent'], ['id' => $item_id]);
|
$item = dba::selectFirst('item', ['uid', 'parent', 'parent-uri'], ['id' => $item_id]);
|
||||||
if ($item['uid'] != 0) {
|
if ($item['uid'] != 0) {
|
||||||
$a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])];
|
$a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])];
|
||||||
} else {
|
} else {
|
||||||
$a->profile = ['uid' => intval($update_uid), 'profile_uid' => intval($update_uid)];
|
$a->profile = ['uid' => intval($update_uid), 'profile_uid' => intval($update_uid)];
|
||||||
}
|
}
|
||||||
$item_parent = $item['parent'];
|
$item_parent = $item['parent'];
|
||||||
|
$item_parent_uri = $item['parent-uri'];
|
||||||
} else {
|
} else {
|
||||||
$item_id = (($a->argc > 2) ? $a->argv[2] : 0);
|
$item_id = (($a->argc > 2) ? $a->argv[2] : 0);
|
||||||
|
|
||||||
|
@ -225,23 +226,25 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
||||||
$item_parent = 0;
|
$item_parent = 0;
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
$r = dba::fetch_first("SELECT `id`, `parent` FROM `item`
|
$r = dba::fetch_first("SELECT `id`, `parent`, `parent-uri` FROM `item`
|
||||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||||
AND `guid` = ? AND `uid` = ?", $a->argv[1], local_user());
|
AND `guid` = ? AND `uid` = ?", $a->argv[1], local_user());
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$item_id = $r["id"];
|
$item_id = $r["id"];
|
||||||
$item_parent = $r["parent"];
|
$item_parent = $r["parent"];
|
||||||
|
$item_parent_uri = $r['parent-uri'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item_parent == 0) {
|
if ($item_parent == 0) {
|
||||||
$r = dba::fetch_first("SELECT `item`.`id`, `item`.`parent` FROM `item`
|
$r = dba::fetch_first("SELECT `item`.`id`, `item`.`parent`, `item`.`parent-uri` FROM `item`
|
||||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||||
AND NOT `item`.`private` AND `item`.`uid` = 0
|
AND NOT `item`.`private` AND `item`.`uid` = 0
|
||||||
AND `item`.`guid` = ?", $a->argv[1]);
|
AND `item`.`guid` = ?", $a->argv[1]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$item_id = $r["id"];
|
$item_id = $r["id"];
|
||||||
$item_parent = $r["parent"];
|
$item_parent = $r["parent"];
|
||||||
|
$item_parent_uri = $r['parent-uri'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,12 +335,15 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
||||||
|
|
||||||
$sql_extra = item_permissions_sql($a->profile['uid'], $remote_contact, $groups);
|
$sql_extra = item_permissions_sql($a->profile['uid'], $remote_contact, $groups);
|
||||||
|
|
||||||
if ($update) {
|
if (local_user() && (local_user() == $a->profile['uid'])) {
|
||||||
if (!dba::exists('item',
|
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
|
||||||
["`item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = ?)
|
$unseen = dba::exists('item', $condition);
|
||||||
$sql_extra AND `unseen` AND `uid` != 0", $item_id])) {
|
} else {
|
||||||
return '';
|
$unseen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($update && !$unseen) {
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = dba::p(item_query()."AND `item`.`parent-uri` = (SELECT `parent-uri` FROM `item` WHERE `id` = ?)
|
$r = dba::p(item_query()."AND `item`.`parent-uri` = (SELECT `parent-uri` FROM `item` WHERE `id` = ?)
|
||||||
|
@ -353,11 +359,9 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
||||||
|
|
||||||
$s = dba::inArray($r);
|
$s = dba::inArray($r);
|
||||||
|
|
||||||
if (local_user() && (local_user() == $a->profile['uid'])) {
|
if ($unseen) {
|
||||||
$unseen = dba::selectFirst('item', ['id'], ['parent' => $s[0]['parent'], 'unseen' => true]);
|
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
|
||||||
if (DBM::is_result($unseen)) {
|
dba::update('item', ['unseen' => false], $condition);
|
||||||
dba::update('item', ['unseen' => false], ['parent' => $s[0]['parent'], 'unseen' => true]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = conv_sort($s, "`commented`");
|
$items = conv_sort($s, "`commented`");
|
||||||
|
|
Loading…
Reference in a new issue