aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-02-10 12:25:11 +0100
committerMario <mario@mariovavti.com>2020-02-10 12:25:11 +0100
commit50dbe1e62d8da44a710f1eb0f7e9d9eaf88c4084 (patch)
treea5a7646e1401b2c943d426f1198c3834f62baee6 /include
parent33be244d8a4ab62d52f7715b5f95ed293be79504 (diff)
parentbbcb237f5b996e94af37611152105b2e965ea493 (diff)
downloadvolse-hubzilla-50dbe1e62d8da44a710f1eb0f7e9d9eaf88c4084.tar.gz
volse-hubzilla-50dbe1e62d8da44a710f1eb0f7e9d9eaf88c4084.tar.bz2
volse-hubzilla-50dbe1e62d8da44a710f1eb0f7e9d9eaf88c4084.zip
Merge branch 'dev' into 'dev'
poll updates See merge request hubzilla/core!1828
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php6
-rw-r--r--include/text.php13
2 files changed, 17 insertions, 2 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 45b2b4d80..327d89e53 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -408,11 +408,15 @@ function count_descendants($item) {
* @return boolean
*/
function visible_activity($item) {
- $hidden_activities = [ ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE, ACTIVITY_POLLRESPONSE, 'Answer' ];
+ $hidden_activities = [ ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE, ACTIVITY_POLLRESPONSE ];
if(intval($item['item_notshown']))
return false;
+ if ($item['obj_type'] === 'Answer') {
+ return false;
+ }
+
foreach($hidden_activities as $act) {
if((activity_match($item['verb'], $act)) && ($item['mid'] != $item['parent_mid'])) {
return false;
diff --git a/include/text.php b/include/text.php
index caecae33e..992b455c8 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1880,6 +1880,17 @@ 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 . '<div>' . $message . '</div>';
+ }
if ($activated and $commentable) {
$output .= EOL . '<input type="button" class="btn btn-std btn-success" name="vote" value="vote" onclick="submitPoll(' . $item['id'] . '); return false;">'. '</form>';
}
@@ -3721,7 +3732,7 @@ function array_path_exists($str,$arr) {
if($search) {
foreach($search as $s) {
- if(array_key_exists($s,$ptr)) {
+ if($ptr && array_key_exists($s,$ptr)) {
$ptr = $ptr[$s];
}
else {