aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2020-02-09 16:32:18 -0800
committerzotlabs <mike@macgirvin.com>2020-02-09 16:32:18 -0800
commitbbcb237f5b996e94af37611152105b2e965ea493 (patch)
tree042ea69cfc8eb90f0588b9c71edb8e4ef164390b /Zotlabs/Module
parentfc9e6d289acf30f89da0051a90cbf16f0bc006fb (diff)
downloadvolse-hubzilla-bbcb237f5b996e94af37611152105b2e965ea493.tar.gz
volse-hubzilla-bbcb237f5b996e94af37611152105b2e965ea493.tar.bz2
volse-hubzilla-bbcb237f5b996e94af37611152105b2e965ea493.zip
poll updates
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Item.php27
-rw-r--r--Zotlabs/Module/Vote.php18
2 files changed, 31 insertions, 14 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 21d59fbc1..e55192c7f 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -719,14 +719,6 @@ class Item extends Controller {
// and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.)
// we may need virtual or template classes to implement the possible alternatives
- $obj = $this->extract_poll_data($body);
- if ($obj) {
- $datarray['obj'] = $obj;
- $obj_type = 'Question';
- }
-
-
-
if(strpos($body,'[/summary]') !== false) {
$match = '';
$cnt = preg_match("/\[summary\](.*?)\[\/summary\]/ism",$body,$match);
@@ -928,6 +920,13 @@ class Item extends Controller {
$mid = z_root() . '/item/' . $uuid;
}
+ $obj = $this->extract_poll_data($body,[ 'item_private' => $private, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_contact_deny ]);
+ if ($obj) {
+ $obj['url'] = $mid;
+ $obj['attributedTo'] = channel_url($channel);
+ $datarray['obj'] = $obj;
+ $obj_type = 'Question';
+ }
if(! $parent_mid) {
$parent_mid = $mid;
@@ -1394,7 +1393,7 @@ class Item extends Controller {
return $ret;
}
- function extract_poll_data(&$body) {
+ function extract_poll_data(&$body,$item) {
$multiple = false;
@@ -1438,7 +1437,15 @@ class Item extends Controller {
if (preg_match('/\[ends\](.*?)\[\/ends\]/',$body,$matches)) {
$obj['endTime'] = datetime_convert(date_default_timezone_get(),'UTC', $matches[1],ATOM_TIME);
- $body = str_replace('[ends]' . $match[1] . '[/ends]', EMPTY_STR, $body);
+ $body = str_replace('[ends]' . $matches[1] . '[/ends]', EMPTY_STR, $body);
+ }
+
+
+ if ($item['item_private']) {
+ $obj['to'] = Activity::map_acl($item);
+ }
+ else {
+ $obj['to'] = [ ACTIVITY_PUBLIC_INBOX ];
}
return $obj;
diff --git a/Zotlabs/Module/Vote.php b/Zotlabs/Module/Vote.php
index 52d6a4bea..2c31d84dc 100644
--- a/Zotlabs/Module/Vote.php
+++ b/Zotlabs/Module/Vote.php
@@ -88,15 +88,25 @@ class Vote extends Controller {
$item['parent_mid'] = $fetch[0]['mid'];
$item['uuid'] = new_uuid();
$item['mid'] = z_root() . '/item/' . $item['uuid'];
- $item['verb'] = 'Answer';
+ $item['verb'] = 'Create';
$item['title'] = $res;
$item['author_xchan'] = $channel['channel_hash'];
$item['owner_xchan'] = $fetch[0]['author_xchan'];
- $item['obj'] = $obj;
- $item['obj_type'] = 'Question';
+ $item['obj_type'] = 'Note';
+ $item['author'] = channelx_by_n($channel['channel_id']);
+
+ $item['obj'] = Activity::encode_item($item,true);
+
+ // now reset the placeholders
+
+ $item['obj_type'] = 'Answer';
+ unset($item['author']);
+
+
+ $x = item_store($item);
+
- $x = item_store($item);
retain_item($fetch[0]['id']);