diff options
author | Mario <mario@mariovavti.com> | 2021-12-22 09:50:50 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-12-22 09:50:50 +0000 |
commit | 27ebeffad41e39dda80159bc27605f5f247174c9 (patch) | |
tree | 7da422007d15240c83bc57a60c2e953ac888eab0 /Zotlabs/Module | |
parent | 07110cee170970b840bbb479e9271a12b4810137 (diff) | |
download | volse-hubzilla-27ebeffad41e39dda80159bc27605f5f247174c9.tar.gz volse-hubzilla-27ebeffad41e39dda80159bc27605f5f247174c9.tar.bz2 volse-hubzilla-27ebeffad41e39dda80159bc27605f5f247174c9.zip |
update_poll() can be called many times in a row for the same item if a multiple poll is being updated. This could result in the queueworker not processing duplicates. We are now adding the source item mid to the notifier call as the third argument (fragment) so that the queueworker will not think they are duplicates. The fragment is also passed to the deliver_hooks call in the notifier
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Vote.php | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/Zotlabs/Module/Vote.php b/Zotlabs/Module/Vote.php index d67a6f176..4f909d33d 100644 --- a/Zotlabs/Module/Vote.php +++ b/Zotlabs/Module/Vote.php @@ -24,7 +24,7 @@ class Vote extends Controller { $fetch = null; $id = argv(1); $response = $_REQUEST['answer']; - + if ($id) { $fetch = q("select * from item where id = %d limit 1", intval($id) @@ -42,7 +42,7 @@ class Vote extends Controller { } $valid = false; - + if ($obj['oneOf']) { foreach($obj['oneOf'] as $selection) { // logger('selection: ' . $selection); @@ -80,7 +80,6 @@ class Vote extends Controller { $item = []; - $item['aid'] = $channel['channel_account_id']; $item['uid'] = $channel['channel_id']; $item['item_origin'] = 1; @@ -95,11 +94,8 @@ class Vote extends Controller { $item['owner_xchan'] = $fetch[0]['author_xchan']; $item['allow_cid'] = '<' . $fetch[0]['author_xchan'] . '>'; $item['item_private'] = 1; - - $item['obj_type'] = 'Note'; $item['author'] = channelx_by_n($channel['channel_id']); - $item['obj'] = Activity::encode_item($item); // now reset the placeholders @@ -108,17 +104,15 @@ class Vote extends Controller { $item['obj_type'] = 'Answer'; unset($item['author']); - $x = item_store($item); - retain_item($fetch[0]['id']); if($x['success']) { $itemid = $x['item_id']; Master::Summon( [ 'Notifier', 'like', $itemid ] ); } - + $r = q("select * from item where id = %d", intval($itemid) ); @@ -128,6 +122,7 @@ class Vote extends Controller { Libsync::build_sync_packet($channel['channel_id'], [ 'item' => [ encode_item($sync_item[0],true) ] ]); } } + $ret['success'] = true; $ret['message'] = t('Response submitted. Updates may not appear instantly.'); json_return_and_die($ret); |