diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index b341d80a3..d851e4d84 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1858,8 +1858,8 @@ class Activity { // These activities should have been handled separately in the Inbox module and should not be turned into posts - if (in_array($act->type, ['Follow', 'Accept', 'Reject', 'Create', 'Update']) - && is_array($a->obj) && array_key_exists('type',$a->obj) && ($a->obj['type'] === 'Follow' || ActivityStreams::is_an_actor($a->obj['type']))) { + if (in_array($act->type, ['Follow', 'Accept', 'Reject', 'Create', 'Update']) && is_array($act->obj) && array_key_exists('type',$act->obj) + && ($act->obj['type'] === 'Follow' || ActivityStreams::is_an_actor($act->obj['type']))) { return false; } diff --git a/include/text.php b/include/text.php index f0f539bd7..d15b6f3b5 100644 --- a/include/text.php +++ b/include/text.php @@ -1680,6 +1680,18 @@ function format_poll($item,$s,$opts) { $activated = ((local_channel() && local_channel() == $item['uid']) ? true : false); $output = $s . EOL. EOL; + $closed = false; + $closing = false; + + if ($item['comments_closed'] > NULL_DATE) { + $closing = true; + $t = datetime_convert('UTC',date_default_timezone_get(), $item['comments_closed'], 'Y-m-d H:i'); + $closed = ((datetime_convert() > $item['comments_closed']) ? true : false); + if ($closed) { + $commentable = false; + } + } + if ($act['type'] === 'Question') { if ($activated and $commentable) { $output .= '
'; @@ -1722,17 +1734,14 @@ function format_poll($item,$s,$opts) { } } } - if ($item['comments_closed'] > NULL_DATE) { - $t = datetime_convert('UTC',date_default_timezone_get(), $item['comments_closed'], 'Y-m-d h:i'); - $closed = ((datetime_convert() > $item['comments_closed']) ? true : false); - if ($closed) { - $message = t('Poll has ended.'); - } - else { - $message = sprintf(t('Poll ends: %s'),$t); - } - $output .= EOL . '
' . $message . '
'; - } + if ($closed) { + $message = t('Poll has ended.'); + } + elseif ($closing) { + $message = sprintf(t('Poll ends: %s'),$t); + } + $output .= EOL . '
' . $message . '
'; + if ($activated and $commentable) { $output .= EOL . ''. '
'; }