diff options
author | Mario <mario@mariovavti.com> | 2023-01-13 20:01:05 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-01-13 20:01:05 +0000 |
commit | 2805520d1bcb2640fc079d54f5f230f7b87d1f84 (patch) | |
tree | 43b3e5bb7c71522d04560015478765a7b763a5fe /Zotlabs/Lib/Activity.php | |
parent | f6d940606350eb8685c278af6d87f3a0b8c0f5e5 (diff) | |
parent | fb7ca18820e7618325dded78a3c3a464dd01b391 (diff) | |
download | volse-hubzilla-2805520d1bcb2640fc079d54f5f230f7b87d1f84.tar.gz volse-hubzilla-2805520d1bcb2640fc079d54f5f230f7b87d1f84.tar.bz2 volse-hubzilla-2805520d1bcb2640fc079d54f5f230f7b87d1f84.zip |
Merge remote-tracking branch 'origin/8.0RC'8.0
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 9dbb15c28..1a1031909 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -672,6 +672,7 @@ class Activity { } } } + return $ret; } @@ -2080,16 +2081,29 @@ class Activity { } - static function update_poll($item, $post) { + static function update_poll($item_id, $post) { $multi = false; $mid = $post['mid']; $content = $post['title']; + if (!$item_id) { + return false; + } + + dbq("START TRANSACTION"); + + $item = q("SELECT * FROM item WHERE id = %d FOR UPDATE", + intval($item_id) + ); + if (!$item) { + dbq("COMMIT"); return false; } + $item = $item[0]; + $o = json_decode($item['obj'], true); if ($o && array_key_exists('anyOf', $o)) { $multi = true; @@ -2161,16 +2175,30 @@ class Activity { } logger('updated_poll: ' . print_r($o, true), LOGGER_DATA); if ($answer_found && !$found) { - q("update item set obj = '%s', edited = '%s' where id = %d", + $u = q("update item set obj = '%s', edited = '%s' where id = %d", dbesc(json_encode($o)), dbesc(datetime_convert()), intval($item['id']) ); - Master::Summon(['Notifier', 'wall-new', $item['id'], $post['mid'] /* trick queueworker de-duplication */ ]); - return true; + if ($u) { + dbq("COMMIT"); + + if ($multi) { + // wait some seconds for possible multiple answers to be processed + // before calling the notifier + sleep(3); + } + + Master::Summon(['Notifier', 'wall-new', $item['id']]); + return true; + } + + dbq("ROLLBACK"); + } + dbq("COMMIT"); return false; } @@ -2456,7 +2484,7 @@ class Activity { $s['attach'] = $a; } - $a = self::decode_iconfig($act->obj); + $a = self::decode_iconfig($act->data); if ($a) { $s['iconfig'] = $a; } @@ -2786,8 +2814,9 @@ class Activity { set_iconfig($s, 'diaspora', 'fields', $diaspora_rawmsg, 1); } - set_iconfig($s, 'activitypub', 'recips', $act->raw_recips); - + if ($act->raw_recips) { + set_iconfig($s, 'activitypub', 'recips', $act->raw_recips); + } $hookinfo = [ 'act' => $act, |