mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:55:15 +00:00
more event and poll work
This commit is contained in:
parent
01a1804b02
commit
d83bdf8b22
2 changed files with 30 additions and 17 deletions
|
@ -536,7 +536,6 @@ class Activity {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $cnv) {
|
||||
$cnv = get_iconfig($i,'ostatus','conversation');
|
||||
}
|
||||
|
@ -544,6 +543,10 @@ class Activity {
|
|||
$ret['conversation'] = $cnv;
|
||||
}
|
||||
|
||||
if (intval($i['item_private']) === 2) {
|
||||
$ret['directMessage'] = true;
|
||||
}
|
||||
|
||||
// $ret['inheritPrivacy'] = true;
|
||||
|
||||
$actor = self::encode_person($i['author'],false);
|
||||
|
@ -2133,6 +2136,10 @@ class Activity {
|
|||
|
||||
set_iconfig($s,'activitypub','recips',$act->raw_recips);
|
||||
|
||||
if (array_key_exists('directMessage',$act->data) && intval($act->data['directMessage'])) {
|
||||
$s['item_private'] = 2;
|
||||
}
|
||||
|
||||
if ($parent) {
|
||||
set_iconfig($s,'activitypub','rawmsg',$act->raw,1);
|
||||
}
|
||||
|
@ -2619,17 +2626,18 @@ class Activity {
|
|||
// simple rendering of incoming polls until they are fully supported
|
||||
|
||||
if ($act['type'] === 'Question') {
|
||||
$content['content'] .= EOL . EOL;
|
||||
if (array_key_exists('anyOf',$act)) {
|
||||
foreach ($act['anyOf'] as $poll) {
|
||||
if (array_key_exists('name',$poll) && $poll['name']) {
|
||||
$content['content'] .= '[ ] ' . html2plain(purify_html($poll['name']),256) . EOL . EOL;
|
||||
$content['content'] .= '[ ] ' . html2plain(purify_html($poll['name']),256) . EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (array_key_exists('oneOf',$act)) {
|
||||
foreach ($act['oneOf'] as $poll) {
|
||||
if (array_key_exists('name',$poll) && $poll['name']) {
|
||||
$content['content'] .= '( ) ' . html2plain(purify_html($poll['name']),256) . EOL . EOL;
|
||||
$content['content'] .= '( ) ' . html2plain(purify_html($poll['name']),256) . EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,9 @@ class Like extends Controller {
|
|||
|
||||
$verb = notags(trim($_GET['verb']));
|
||||
|
||||
if(! $verb)
|
||||
if (! $verb) {
|
||||
$verb = 'like';
|
||||
}
|
||||
|
||||
$activity = $this->reaction_to_activity($verb);
|
||||
|
||||
|
@ -345,8 +346,9 @@ class Like extends Controller {
|
|||
}
|
||||
else {
|
||||
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
|
||||
if($item['obj_type'] === ACTIVITY_OBJ_EVENT)
|
||||
if ($item['obj_type'] === ACTIVITY_OBJ_EVENT) {
|
||||
$post_type = t('event');
|
||||
}
|
||||
|
||||
$objtype = $item['obj_type'];
|
||||
|
||||
|
@ -354,15 +356,17 @@ class Like extends Controller {
|
|||
|
||||
$object = json_encode(Activity::fetch_item( [ 'id' => $item['mid'] ]));
|
||||
|
||||
if(! intval($item['item_thread_top']))
|
||||
if (! intval($item['item_thread_top'])) {
|
||||
$post_type = 'comment';
|
||||
}
|
||||
|
||||
$arr['item_origin'] = 1;
|
||||
$arr['item_notshown'] = 1;
|
||||
$arr['item_type'] = $item['item_type'];
|
||||
|
||||
if(intval($item['item_wall']))
|
||||
if (intval($item['item_wall'])) {
|
||||
$arr['item_wall'] = 1;
|
||||
}
|
||||
|
||||
// if this was a linked photo and was hidden, unhide it and distribute it.
|
||||
|
||||
|
@ -396,13 +400,14 @@ class Like extends Controller {
|
|||
if($verb === 'attendmaybe')
|
||||
$bodyverb = t('%1$s may attend %2$s\'s %3$s');
|
||||
|
||||
if(! isset($bodyverb))
|
||||
if (! isset($bodyverb)) {
|
||||
killme();
|
||||
}
|
||||
|
||||
// @FIXME Not sure if this is still needed
|
||||
// if(local_channel() && $verb === 'attendyes') {
|
||||
// event_addtocal($item['id'],$ch[0]['channel_id']);
|
||||
// }
|
||||
|
||||
if (local_channel() && $verb === 'attendyes') {
|
||||
event_addtocal($item['id'],$ch[0]['channel_id']);
|
||||
}
|
||||
|
||||
if($extended_like) {
|
||||
$ulink = '[zrl=' . $ch[0]['xchan_url'] . ']' . $ch[0]['xchan_name'] . '[/zrl]';
|
||||
|
|
Loading…
Reference in a new issue