aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-10-26 13:00:26 -0700
committerzotlabs <mike@macgirvin.com>2018-10-26 13:00:26 -0700
commitae4aeb4b1e57855d8f1788e74c56b57377df59aa (patch)
tree3bc30380bccb0fdb89df911abf831af9f91f520a
parent9cedc864c296ad3fb394692440551c97bc644522 (diff)
downloadvolse-hubzilla-ae4aeb4b1e57855d8f1788e74c56b57377df59aa.tar.gz
volse-hubzilla-ae4aeb4b1e57855d8f1788e74c56b57377df59aa.tar.bz2
volse-hubzilla-ae4aeb4b1e57855d8f1788e74c56b57377df59aa.zip
delivery chain linkage messed up if original post was edited
-rwxr-xr-xinclude/items.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/include/items.php b/include/items.php
index 58461cc3a..cae380b01 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2150,6 +2150,7 @@ function item_store_update($arr, $allow_exec = false, $deliver = true) {
unset($arr['created']);
unset($arr['author_xchan']);
unset($arr['owner_xchan']);
+ unset($arr['source_xchan']);
unset($arr['thr_parent']);
unset($arr['llink']);
@@ -2514,7 +2515,7 @@ function tag_deliver($uid, $item_id) {
// Just start the second delivery chain to deliver the updated post
// after resetting ownership and permission bits
logger('updating edited tag_deliver post for ' . $u[0]['channel_address']);
- start_delivery_chain($u[0], $item, $item_id, 0);
+ start_delivery_chain($u[0], $item, $item_id, 0, true);
return;
}
@@ -2941,7 +2942,7 @@ function tgroup_check($uid, $item) {
* @param int $item_id
* @param boolean $parent
*/
-function start_delivery_chain($channel, $item, $item_id, $parent) {
+function start_delivery_chain($channel, $item, $item_id, $parent, $edit = false) {
$sourced = check_item_source($channel['channel_id'],$item);
@@ -2950,7 +2951,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
intval($channel['channel_id']),
dbesc(($item['source_xchan']) ? $item['source_xchan'] : $item['owner_xchan'])
);
- if($r) {
+ if($r && ! $edit) {
$t = trim($r[0]['src_tag']);
if($t) {
$tags = explode(',',$t);
@@ -3017,9 +3018,17 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
}
else {
$item_uplink = 1;
- $r = q("update item set source_xchan = owner_xchan where id = %d",
- intval($item_id)
- );
+
+ // if this is an edit, item_store_update() will have already updated the item
+ // with the correct value for source_xchan (by ignoring it). We cannot set to owner_xchan
+ // in this case because owner_xchan will point to the parent of this chain
+ // and not the original sender.
+
+ if(! $edit) {
+ $r = q("update item set source_xchan = owner_xchan where id = %d",
+ intval($item_id)
+ );
+ }
}
$title = $item['title'];